G
Guest
I have an ASP.NET example which programmatically builds a drop down list.
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList ddlCategories;
public class WebForm1 : System.Web.UI.Page
{
if (!IsPostBack)
{
// If page is requested for the first time
ddlCategories.Items.Add("Web development");
ddlCategories.Items.Add("Programming Languages");
ddlCategories.Items.Add("Certifications");
}
aString = ddlCategories.SelectedItem.ToString();
}
When it IS a postback, how is the Drop Down list populated?
I have confirmed that the drop down list is not populated in the .aspx file
I have disabled viewstate for the application, the list is still populated,
however the "SelectedItem" property is lost.
TIA
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList ddlCategories;
public class WebForm1 : System.Web.UI.Page
{
if (!IsPostBack)
{
// If page is requested for the first time
ddlCategories.Items.Add("Web development");
ddlCategories.Items.Add("Programming Languages");
ddlCategories.Items.Add("Certifications");
}
aString = ddlCategories.SelectedItem.ToString();
}
When it IS a postback, how is the Drop Down list populated?
I have confirmed that the drop down list is not populated in the .aspx file
I have disabled viewstate for the application, the list is still populated,
however the "SelectedItem" property is lost.
TIA