G
Guest
Hi,
I am having troubles dealing with dynamically created WebControls. I have
this HTML code:
<form id="Form1" runat="server" method="post">
<table width="960" align="center">
<tr>
<td align="center">
......
<td colspan="5">
<div id="plhFilters" runat="server"></div>
.........
I added the following code in Page_Load of the code-behind:
ddlStage.DataSource = clsBbDataAccess.getStages()
ddlStage.DataValueField = "value"
ddlStage.DataTextField = "name"
ddlStage.DataBind()
ddlStage.Items.Insert(0, "")
plhFilters.Controls.Add(ddlStage)
ddlStage.ID = row("WebControl_name")
I then have a button on the page that does a postback, where I should read
the value of the dynamically created DropDownList. But my control is always
set to Nothing when I am in the code-behind after the postback occurred.
I also tried to set the "EnableViewState" property to "true", without luck.
What am I doing wrong here?
Thanks.
Mike
I am having troubles dealing with dynamically created WebControls. I have
this HTML code:
<form id="Form1" runat="server" method="post">
<table width="960" align="center">
<tr>
<td align="center">
......
<td colspan="5">
<div id="plhFilters" runat="server"></div>
.........
I added the following code in Page_Load of the code-behind:
ddlStage.DataSource = clsBbDataAccess.getStages()
ddlStage.DataValueField = "value"
ddlStage.DataTextField = "name"
ddlStage.DataBind()
ddlStage.Items.Insert(0, "")
plhFilters.Controls.Add(ddlStage)
ddlStage.ID = row("WebControl_name")
I then have a button on the page that does a postback, where I should read
the value of the dynamically created DropDownList. But my control is always
set to Nothing when I am in the code-behind after the postback occurred.
I also tried to set the "EnableViewState" property to "true", without luck.
What am I doing wrong here?
Thanks.
Mike