[newbie] DropDownList problem - asp.net 2.0

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
 
S

Spencer Judge

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top