动态添加的行在回发时消失

时间:2014-08-11 10:28:50

标签: c# asp.net dynamic html-table

嗨我的.aspx页面中有一个html表格,我将行添加到html表格动态,但它们在回发时消失,怎么做plz帮助我

for (int i = 0; i < gettop20.Count; i++)
{
    TableRow dtrFr63a = new TableRow();
    dtrFr63a.Attributes["style"] = "font-family: Calibri; border: 0px solid black;font-size: 14px; font-style: normal; page-break-after:always;";
    TableCell dtd223a = new TableCell();
    Button btn1 = new Button();
    btn1.Text = _LabInvestigationDetailsService.getById(Convert.ToInt32(gettop20[i])).LabInvName;
    btn1.ID = gettop20[i].ToString();
    try
    {
        btn1.Attributes.Add("class", "btnMbl");
    }
    catch { }
    btn1.Attributes["style"] = "overflow: hidden; text-overflow: ellipsis;";
    btn1.Click += new EventHandler(btn1_Click);
    dtd223a.Controls.Add(btn1);
    dtrFr63a.Cells.Add(dtd223a);
    tblPresTests.Rows.Add(dtrFr63a);                
    tblPresTests.DataBind();                   
}

0 个答案:

没有答案