c# - Auto add row in table HTML -
i have table in page lists user , email when user sends information how can make table add row each post , not delete other line?
my aspx
<table id="tblusers" class="table table-bordered table-striped"> <tbody id="tbodyuser"> <tr> <asp:label id="lblheader" font-bold="true" runat="server" visible="false">user access</asp:label> <td> <asp:label id="lbluser" runat="server" visible="false"></asp:label> </td> <td> <asp:label id="lblemail" runat="server" visible="false"></asp:label> </td> </tr> </tbody> </table> my .cs
protected void btnsenduser_onclick(object sender, eventargs e) { string logininfo = txtuseradd.text; principalcontext insprincipalcontext = new principalcontext(contexttype.domain, "x.com", "amsndrsecuritysqlser", "xxx"); userprincipal insuserprincipal = userprincipal.findbyidentity(insprincipalcontext, logininfo); //it's first post if (lbluser.visible == false && lblemail.visible == false) { if (insuserprincipal == null) { lblerror.visible = true; } else { lbluser.visible = true; lblemail.visible = true; lblheader.visible = true; lbluser.text = insuserprincipal.givenname + " " + insuserprincipal.surname; lblemail.text = insuserprincipal.emailaddress; } } }
you must add runat="server" table tblusers
var row =new system.web.ui.htmlcontrols.htmltablerow(); var cell = new system.web.ui.htmlcontrols.htmltablecell(); cell.innertext = "new cell"; row.cells.add(cell); tblusers.rows.add(row);
Comments
Post a Comment