</asp:DropDownList> //On your .cs file write code in the following method. protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e){ }
double click on dropdownlist it shows following code
then write whwtever u want in that ,
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
}
misteraddi
Member
54 Points
103 Posts
selectedindexchanged
Mar 03, 2012 09:51 AM|LINK
i want to write onselected id change for my code
im stack....how do i go about it
<asp:DropDownList ID="category" runat="server" AutoPostBack="True" Width="199px"> <asp:ListItem>Computers</asp:ListItem> <asp:ListItem>Phones & Portables</asp:ListItem> <asp:ListItem>Services</asp:ListItem> <asp:ListItem>Video Tutorials</asp:ListItem> </asp:DropDownList>karthicks
All-Star
31382 Points
5424 Posts
Re: selectedindexchanged
Mar 03, 2012 09:53 AM|LINK
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem>Others</asp:ListItem> <asp:ListItem Selected="True">A</asp:ListItem> <asp:ListItem>B</asp:ListItem> <asp:ListItem>C</asp:ListItem> </asp:DropDownList> protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Response.Write(this.DropDownList1.SelectedValue); }Karthick S
mishra.bhupe...
Participant
1596 Points
378 Posts
Re: selectedindexchanged
Mar 03, 2012 09:57 AM|LINK
<asp:ListItem>Computers</asp:ListItem> <asp:ListItem>Phones & Portables</asp:ListItem> <asp:ListItem>Services</asp:ListItem> <asp:ListItem>Video Tutorials</asp:ListItem>ramiramilu
All-Star
95503 Points
14106 Posts
Re: selectedindexchanged
Mar 03, 2012 10:04 AM|LINK
http://www.ezineasp.net/post/ASP-Net-DropDownList-OnSelectedIndexChanged-Event.aspx
Thanks,
JumpStart
Mahesh Darku...
Participant
896 Points
238 Posts
Re: selectedindexchanged
Mar 03, 2012 10:15 AM|LINK
double click on dropdownlist it shows following code then write whwtever u want in that , protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { }misteraddi
Member
54 Points
103 Posts
Re: selectedindexchanged
Mar 03, 2012 10:23 AM|LINK
to Karthick S
i like your codes, it works perfectly, but it keeps posting the selected value at the page,
how do i get rid of that??
karthicks
All-Star
31382 Points
5424 Posts
Re: selectedindexchanged
Mar 03, 2012 10:30 AM|LINK
hi,
i dont understand what do you mean by Posting?
on selection if you do want to do Postback set AutoPostBack=false;
or if you dont want to write just remove Respose.Write
</div>Karthick S
misteraddi
Member
54 Points
103 Posts
Re: selectedindexchanged
Mar 03, 2012 06:53 PM|LINK
to Karthick S, can u send me ur mail so i can send ur my code for u to review for me?