Sunday 2 February 2014

Navigation on DropDownList SelectIndaxChanged Event


put this code inside of body tag

<body> 
<form id="form1" runat="server"> 
<div> 
<h1> Select Profile</h1><br /> 
<asp:DropDownList ID="dl" runat="server" onselectedindexchanged="dl_SelectedIndexChanged" AutoPostBack="true" > 

<asp:ListItem>Slect Profile</asp:ListItem> 
<asp:ListItem>Sandeep</asp:ListItem> 
<asp:ListItem>Pradeep</asp:ListItem> 
<asp:ListItem>Dinesh</asp:ListItem> 

</asp:DropDownList> 
</div> 
</form> 
</body> 


put this inside of DropdownList SelectIndexChanged


protected void dl_SelectedIndexChanged(object sender, EventArgs e) 


if (dl.SelectedItem.Text == "Sandeep") 
Response.Redirect("sandeep.aspx"); 

if (dl.SelectedItem.Text == "Pradeep") 
Response.Redirect("pradeep.aspx"); 

if (dl.SelectedItem.Text == "Dinesh") 
Response.Redirect("dinesh.aspx"); 

}

No comments:

Post a Comment