Click here to Skip to main content
15,891,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
This is Chandra
I have one query. I have an ASPX page. In that i have one drop down list. This Drop down list is performing some operations. Now i have an User Control which has one Radio button. My problem is how can i call Drop down list Selection change event in Radio Button List Selection Change event to perform same operations.
Can any one suggest me for the above query.

Thanks
Chandra
Posted
Comments
farham_heidari 5-Dec-12 12:56pm    
hi a part of code can help me to understand what you need ?

Suppose here is a DropDownList in aspx page:
ASP.NET
<asp:dropdownlist id="ddlTest" runat="server">
   <asp:listitem>Food</asp:listitem>
   <asp:listitem>Clothes</asp:listitem>
</asp:dropdownlist>


Now from your user control you'll get the above DropDownList by writing this following code:
C#
DropDownList ddlTest = (DropDownList)this.Parent.FindControl("ddlTest");

Now you can do anything with this DropDownList which is in your aspx page.

I hope this will help.
Thanks.
 
Share this answer
 
v2
What I understood is you have to execute same code block on DropDownList selection change event and on RadioButtonList selection change event. If this is true, use either one of the following solutions.

Solution 1:
Move the code from DropDownList event to a common method and call this method from both DropdownList and RadioButtonList selection changed event

Solutions 2:
Use the selectedIndexChanged event of DropDownList for RadioButtonList also. Here the event name "DropDownList1_SelectedIndexChanged" assigned for Radiobuttonlist as well.

XML
<asp:DropDownList ID="DropDownList1" runat="server"
           onselectedindexchanged="DropDownList1_SelectedIndexChanged">
           <asp:ListItem>Test1</asp:ListItem>
           <asp:ListItem>Test2</asp:ListItem>
       </asp:DropDownList>

       <asp:RadioButtonList ID="RadioButtonList1" runat="server"
           onselectedindexchanged="DropDownList1_SelectedIndexChanged">
           <asp:ListItem>test11</asp:ListItem>
           <asp:ListItem>Test22</asp:ListItem>
       </asp:RadioButtonList>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900