我正在尝试将MaxLength函数用于后面代码中的文本框。
如何在这里动态创建textbox txttabname。任何的想法?非常感谢提前!!
for (int i = 0; i < additionalPageCount; i++)
{
if (i == 0)
{
this.pnlProfilePages.Controls.Add(new LiteralControl("<tr><td colspan=\"4\" style=\"width:100px;font-size:11px; padding-bottom: 10px;\"><h3>Page Tabs</h3></td></tr>"));
}
this.pnlProfilePages.Controls.Add(new LiteralControl("<tr><td style=\"font-size:11px; padding-left:6px;\">Tab Name :</td><td style=\"padding-right:10px;font-size:11px;MaxLength:20\">"));
string txtTabControlID = "txtTabName" + i.ToString();
TextBox txtTab = new TextBox();
txtTab.ID = txtTabControlID;
txtTab.Width = 100;
txtTab.TabIndex = lastTabIndex++;
}
}
答案 0 :(得分:2)
txtTab.MaxLength = 100;
答案 1 :(得分:0)
txtTab.MaxLength = 20;
这是你想要做的吗?