multiple user controls on one page

Results 1 to 3 of 3

Thread: multiple user controls on one page

  1. #1
    Join Date
    Dec 1969

    Default multiple user controls on one page

    Hi,<BR>I have an aspx page that contains multiple user controls (ascx files). Each user control contains a number of input boxes. In another user control, I have an "Update" button. When that button is clicked, I need to retrieve the properties/values of all the input boxes located in the other ascx files. <BR><BR>All the samples I have seen treat the user controls as completely isolated pieces of code. The user controls are an abstract class so I can&#039;t create a public property and create an instance of the class in another ascx file. Does anyone know of any examples where the main aspx file (or another ascx file) can retrieve values/properties etc from a seperate user control?

  2. #2
    Join Date
    Dec 1969

    Default session variable band-aid

    there might very well be a "clean" way of doing what you want using classes in the .net framework. but that might take a long time to find<BR><BR>in the meantime, i find that it works to use session variables to communicate between different user controls on the same page. one ascx(or aspx) file populates a session variable, and the other ascx files read the session variable.<BR><BR>a little extra overhead is involved in this solution, but it works. and it doesnt require days of research before-hand<BR><BR>does this help? if so, i would appreciate some help with my own currently open problem, which you can read at:<BR><BR><BR>

  3. #3

    Default RE: multiple user controls on one page

    If you know the ID, you can use<BR>Page.FindControl(ID) in controlA to get controlB when they are both in the same page.<BR>Not a great idea.<BR><BR><BR>You should probably put the event handler code in a context where both controlA and controlB are directly accessible. <BR>controlA should fire an Update event when it&#039;s update button is clilcked.<BR>Your page should add an event handler<BR> this.controlA.Update+= new ControlEvent(this.ControlA_Update)<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts