How do I return the name (ID) of the User Control that Raised an Event?

G

Gummy

Hello,

I have a user control (contains two listboxes, labels and radio buttons)
that appears on my webpage multiple times. When the radio buttons are
clicked I am able to process (consume?) that Event (SelectedIndexChange) on
the main page.

What I am having a problem with is figuring out which of the user controls
raised that Event. If I know which user control raised the Event I hope to
then refill the listbox with new data.

How do I tell which user control's radio buttons I clicked?

I have this pseudo-code on the main page:
private void WebForm1_SelectedIndexChange(object sender, EventArgs e)
{
DoFunction( User Control Name);
}

I tried sender.GetType().ToString() but that just told me the user control
(UserControl.ascx) and not the actual ID that I assigned to it.

Any help would be greatly appreciated.

Thank you.



p.s. I saw something about a nested Class in the user control that contains
the ID or other information about it, but I certainly don't understand that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top