The bizarre thing is the AutoPostBack="True" does fire. If I place a
breakpoint in my code on the Page_Load it is hit after I select
something in the DropDownList. But when it hitsthe line to see if
it's a postback or not it says it isn't. If I hover over if(!
this.IsPostBack) it tells me IsPostBack is false.
So even the the postback has fired and the breakpoint has been
triggered in my Page_load method, it thinks it's not a postback.
That's what baffles me...
snippet of Page_Load to bind data...
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
LoadMakes();
}
else // postback
{
nMakeID = int.Parse(DropDownListMake.SelectedValue);
}
}
private void LoadMakes()
{
DataTable dtMakes = new NewBike().GetMakes("Bike");
ClearDropDowns(true, true);
PopulateDropDown(DropDownListMake, dtMakes, "makeid", "makename",
"Make");
}
private void PopulateDropDown(DropDownList ddlList, DataTable dtData,
string strValueField, string strTextField, string strDefaultPromt)
{
ddlList.DataSource = dtData;
ddlList.DataValueField = strValueField;
ddlList.DataTextField = strTextField;
ddlList.DataBind();
ddlList.Items.Insert(0, new ListItem("Choose " + strDefaultPromt,
"-1"));
ddlList.SelectedIndex = 0;
}