|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How do I return the name (ID) of a user control?I have a single 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. 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. > What I am having a problem with is figuring out which of the user controls Publish an event in the UserContorl - say SelectedIndexChanged.> raised that Event. If I know which user control raised the Event. > > How do I tell which user control's radio buttons I clicked? Raise this event when RadioButton is clicked. Using the 'sender' semantics and/or appropriate EventArgs, you can send the 'ID' of the UserControl. -- Happy Hacking, Gaurav Vaish | http://www.mastergaurav.com http://www.edujinionline.com http://articles.edujinionline.com/webservices ------------------- Thank you for the information.
I have multiple user controls that I placed in the ASPX page. If I define an event for each button, droplistbox, etc. in the ASCX, do I need to "wire" each event, for each user control in the ASPX page? Thank you. "Gaurav Vaish (www.EduJiniOnline.com)" <gaurav.vaish.nospam@nospam.gmail.com> wrote in message Show quoteHide quote news:O8UV$p61GHA.4476@TK2MSFTNGP02.phx.gbl... > > 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. > > > > How do I tell which user control's radio buttons I clicked? > > Publish an event in the UserContorl - say SelectedIndexChanged. > Raise this event when RadioButton is clicked. > > Using the 'sender' semantics and/or appropriate EventArgs, you can send the > 'ID' of the UserControl. > > > -- > Happy Hacking, > Gaurav Vaish | http://www.mastergaurav.com > http://www.edujinionline.com > http://articles.edujinionline.com/webservices > ------------------- > > > Thank you for the information. Yes.> > I have multiple user controls that I placed in the ASPX page. If I define > an > event for each button, droplistbox, etc. in the ASCX, do I need to "wire" > each event, for each user control in the ASPX page? Because, for each of the buttons in 'myself', you want to tell that 'I' have been clicked. -- Happy Hacking, Gaurav Vaish | http://www.mastergaurav.com http://www.edujinionline.com http://articles.edujinionline.com/webservices ------------------- Thank you!
"Gaurav Vaish (www.EduJiniOnline.com)" <gaurav.vaish.nospam@nospam.gmail.com> wrote in message Show quoteHide quote news:OIy$VaG2GHA.4588@TK2MSFTNGP04.phx.gbl... >> Thank you for the information. >> >> I have multiple user controls that I placed in the ASPX page. If I define >> an >> event for each button, droplistbox, etc. in the ASCX, do I need to "wire" >> each event, for each user control in the ASPX page? > > Yes. > Because, for each of the buttons in 'myself', you want to tell that 'I' > have been clicked. > > > -- > Happy Hacking, > Gaurav Vaish | http://www.mastergaurav.com > http://www.edujinionline.com > http://articles.edujinionline.com/webservices > ------------------- > >
Space in fileupload control
asp:TextBox add a link button to prev/next in a wizard Binding an array to a DropDownList How to implement interface's method in aspx? Default Border Color for Dropdownlist Control? calendar control - weekends word wrap in ultrawebtree word wrap in ultrawebtree word wrap in ultrawebtree |
|||||||||||||||||||||||