DropDownList AutoPostBack not hitting break point

205 Views Asked by At

The auto post back for my drop down list is not hitting the break point in the code behind. It appears that changing the value of the drop down list is not causing the post back at all.

<asp:DropDownList ID="RidingType" runat="server" CssClass="option" DataValueField="VarId" DataTextField="Name" AutoPostBack="true" OnSelectedIndexChanged="RidingType_SelectedIndexChanged"></asp:DropDownList>

I have tried both OnSelectedIndexChanged and OnTextChanged. I am doing something similar on a different page, where it does work as expected.

<asp:DropDownList CssClass="listBoxes" runat="server" ID="lstBrands" DataValueField="brand" DataTextField="brand" AutoPostBack="true" OnTextChanged="lstBrands_SelectedIndexChanged" Width="100%"></asp:DropDownList>

I've done everything I can to match up the surrounding environments. Any ideas as to why the first appears not to post back and the second works correctly?

Edit: Here is an excerpt from the code behind the binding function

protected void Page_Load(object sender, EventArgs e)
{
    if(!Page.IsPostBack)
    {
         /* code to set up other drop down lists */
         BindRidingType();
         /* more of the same */
    }
}

private void BindRidingType()
{
    prams[3].Value = "Riding Type";
    RidingType.DataSource = ReturnSelection(prams); //return DataTable from Database   
    RidingType.SelectedValue = DefaultValue("Riding Type"); //Finds default value for list
    RidingType.DataBind();        
}

Per suggestion I tried not setting a default value, but I saw no change.

Edit: The event handler as requested

 protected void RidingType_SelectedIndexChanged(object sender, EventArgs e)                   
{
    throw new NotImplementedException();
}
0

There are 0 best solutions below