[newbie] DropDownList problem - asp.net 2.0

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

Hey

asp.net 2.0

I have a asp.net 2.0 webpage which contain this markup:
<asp:DropDownList ID="ddlSelectView"
OnSelectedIndexChanged="ddlSelectView_SelectionChange" runat="server">
<asp:ListItem Value="0" Selected="True">Item 0</asp:ListItem>
<asp:ListItem Value="1">Item 1</asp:ListItem>
</asp:DropDownList>

My goal is to add some funtionalty (ddlSelectView_SelectionChange) to the
DropDownList which executes each time a selection changed has been done on
the DropDownList

The problem is that when the selection is changed the
ddlSelectView_SelectionChange method isn't called.

This is ddlSelectView_SelectionChange method:
protected void ddlSelectView_SelectionChange(Object sender, EventArgs e)
{
DropDownList dropdownlist =
(DropDownList)table1.FindControl("ddlSelectView");
int g = dropdownlist.SelectedIndex;
}

What am I doing wrong here?

Best Regards!

Jeff
 
Jeff said:
My goal is to add some funtionalty (ddlSelectView_SelectionChange) to the
DropDownList which executes each time a selection changed has been done on
the DropDownList

The method won't get called until you submit the form. You make the
list submit automatically using:

<asp:DropDownList autopostback="true" ...

Spence
 
Back
Top