MaxLength property for textbox in code behind?
I am trying to use MaxLength function for the textbox in code behind.
How is it possible for textbox txttabname here, which is created dynamically. Any idea? Thanks a lot in advance!!
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 txt开发者_C百科Tab = new TextBox();
txtTab.ID = txtTabControlID;
txtTab.Width = 100;
txtTab.TabIndex = lastTabIndex++;
}
}
txtTab.MaxLength = 100;
txtTab.MaxLength = 20;
Is that what you're trying to do?
精彩评论