Posts Tagged ‘dynamic control’
When you want to get a value of a dynamically created control, you need to create the control again while postback.
——————————————————-
for example:
protected void Page_Load(object sender, EventArgs e)
{
if(IsPostBack)
createDynamicDDL();
}
private void createDynamicDDL()
{
DropDownList ddl_1 = new DropDownList();
tc.add(ddl_1); // TableCell(Let’s say tc already exist.)
tr.add(tc);
tbl.add(tr);
}
——————————————————-
Unless you don’t do this, NullReferenceException will be occurred.
Filed under: ASP.NET Tips | Leave a Comment
Tags: dynamic control



