OKi, in addition to my above answer, there is a solution which uses interface. First, we implement an Interface: public interface IRadioButtonListEvent { void RadioButtonIndexChangedProc(object sender, System.EventArgs e); }
As you can see, our interface implements just one method, which will be called whenever selected item index changes. Now, in the User Control, RadioButtonList1_SelectedIndexChanged
should look like this: private void RadioButtonList1_SelectedIndexChanged(object sender, System.EventArgs e) { IRadioButtonListEvent iPage = (IRadioButtonListEvent) Page; iPage.RadioButtonIndexChangedProc(sender, e); }
And finally, code for hosting web page. As i mentioned above, page must implement an IRadioButtonListEvent
interface. public class WebForm1 : System.Web.UI.Page, IRadioButtonListEvent ... public void RadioButtonIndexChangedProc(object sender, System.EventArgs e) { RadioButtonList rbl = (RadioButtonList) sender; // do whatever you need... }
-- Mariusz 'mAv' Wójcik master e-software engineer