G
Gummy
Hello,
I created a user control that has a ListBox and a RadioButtonList (and other
stuff). The idea is that I put the user control on the ASPX page multiple
times and each user control will load with different data (locations,
departments, etc.).
When I click the RadioButtonList the Event is raised on the user control and
I can consume(?) it on the ASPX page. However, I needed to give each user
control its own ID, add the "protected UserControlType userControlID" to the
declarations, and then wire each of them to an Event to get them to work or
to even recognize their ID when the Event is raised.
It works, but my understanding that this is a poor way of doing things. Is
there a better way to approach this?
Here's some of the code in the ASPX page, to recognize the Event:
private void InitializeComponent(){
this.Load += new
System.EventHandler(this.Page_Load);
ucLocation.rblCodeDescrChanged += new
System.EventHandler(this.ChangedSelectionUCRadioButtons);
ucDepartment.rblCodeDescrChanged += new
System.EventHandler(this.ChangedSelectionUCRadioButtons);
}
private void ChangedSelectionUCRadioButtons(object sender, System.EventArgs
e)
{
ReLoadControls((Selection)sender);
}
Thank you for the help.
-Gummy
I created a user control that has a ListBox and a RadioButtonList (and other
stuff). The idea is that I put the user control on the ASPX page multiple
times and each user control will load with different data (locations,
departments, etc.).
When I click the RadioButtonList the Event is raised on the user control and
I can consume(?) it on the ASPX page. However, I needed to give each user
control its own ID, add the "protected UserControlType userControlID" to the
declarations, and then wire each of them to an Event to get them to work or
to even recognize their ID when the Event is raised.
It works, but my understanding that this is a poor way of doing things. Is
there a better way to approach this?
Here's some of the code in the ASPX page, to recognize the Event:
private void InitializeComponent(){
this.Load += new
System.EventHandler(this.Page_Load);
ucLocation.rblCodeDescrChanged += new
System.EventHandler(this.ChangedSelectionUCRadioButtons);
ucDepartment.rblCodeDescrChanged += new
System.EventHandler(this.ChangedSelectionUCRadioButtons);
}
private void ChangedSelectionUCRadioButtons(object sender, System.EventArgs
e)
{
ReLoadControls((Selection)sender);
}
Thank you for the help.
-Gummy