I have a dropdownlistbox that is populated from a table in a database. When the user clicks on one of the item in the list, I need the page to redirect page(x). How is that done?
Printable View
I have a dropdownlistbox that is populated from a table in a database. When the user clicks on one of the item in the list, I need the page to redirect page(x). How is that done?
make a method called somethign like
then in your DropDownlist add the following propertyCode:myDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Redirect("somePage.aspx");
}
and if you need the value that was selected you can useCode:<asp:DropDownList id="blah" runat="server" OnSelectedIndexChanged="myDropDownList_SelectedIndexChanged">
</asp:DropDownList>
hth,Code:myDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlTemp = (DropDownList)sender;
int selectedValue = int.parse(ddlTemp.SelectedValue.ToString());
Response.Redirect("somePage.aspx?id="+selectedValue.ToString());
}
mcm