English 中文(简体)
动态增加浏览量(按纽芬兰语计)——使用动态的超文本——没有显示
原标题:Dynamically adding row asp.net (on button click) - using dynamic HTML - row not shown

我坐在桌上,有一个顿。 这种方法第一次被称作是页数,它完全运作。 当我向纽斯排队报到时,这一方法被叫去时,我能够看到该行的脱节。 本表的增额,但在浏览器中,没有出现新情况(因此,可能出现一行的情况)。 我在“我问答”中使用一个更新小组,但我有同样的影响。 我也尝试在这种方法中逐次重提这个表格,但只有一行是SHOWN/RENDERED,但如果我把一些东西放在一行,然后添加另一个字,第一行的脚步就消失了,则可能增加一行,而前一行则删除? Maybe 我必须利用这一看法? 谁能指导我正确解决办法?

private void AddSlot()
        {
            DropDownList ddlProfiles = new DropDownList();
            ddlProfiles.DataSource = DLProfiles.Instance.GetAllProfilesByGid(Int32.Parse(Session["gid"].ToString()));
            ddlProfiles.DataTextField = "pName";
            ddlProfiles.DataBind();

            TableRow row = new TableRow();

            TableCell cellProfile = new TableCell();
            cellProfile.Controls.Add(ddlProfiles);

            TableCell cellStart = new TableCell();
            TextBox startTime = new TextBox();
            cellStart.Controls.Add(startTime);

            TableCell cellEnd = new TableCell();
            TextBox endTime = new TextBox();
            cellEnd.Controls.Add(endTime);

            row.Cells.Add(cellProfile);
            row.Cells.Add(cellStart);
            row.Cells.Add(cellEnd);

            scheduleTable.Rows.Add(row);

        }

<asp:UpdatePanel ID="pnlSchedTable" runat="server">
                <ContentTemplate>
        <div id="divCurrentSchedule" runat="server">
            <h3 id="scheduleTitle" runat="server">
            </h3>

                    <asp:Table ID="scheduleTable" runat="server">
                        <asp:TableHeaderRow ID="rowHeaders" runat="server">
                            <asp:TableHeaderCell Text="Profile Name" />
                            <asp:TableHeaderCell Text="Start time" />
                            <asp:TableHeaderCell Text="End time" />
                        </asp:TableHeaderRow>
                    </asp:Table>
                    <asp:Button ID="btnNewSlot" runat="server" OnClick="btnNewSlot_Click" Text="New Slot" />

        </div></ContentTemplate>
            </asp:UpdatePanel>
问题回答

When are you calling AddSlot? Chances are, if you want it to run after any page request, whether it be an initial load or a button click, you should move it to Pre-Render ...then your timing issues will be adjusted.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签