Passing Data Between Two ASCX controls within a ASPX page

I have a .aspx page in which I have two .ascx controls:

SearchForm.ascx & Summary.ascx

In SearchForm.ascx I have a form containing Name,Email,Phone etc.

I can't figure out a way to display the form data on the Summary.ascx - can anyone help?
LVL 1
JimDestructAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Ted BouskillConnect With a Mentor Senior Software DeveloperCommented:
Use another property on the other control.  They are get/set so you get the property from one control when the submit fires and set it on the other control.
0
 
Ted BouskillSenior Software DeveloperCommented:
So the search form captures the information and the summary displays it?
0
 
JimDestructAuthor Commented:
the SearchForm.ascx contains the form itself - OnClick of the submit button  I want the details of the form fields to be accessible in Summary.ascx
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Ted BouskillSenior Software DeveloperCommented:
What you need to do is expose public properties on the Summary.ascx control that can be used by the page to populate it.  Then when the OnClick is pressed and your page executes code in response, the page can then populate the Summary.ascx control using the public properties.  Sometimes the easiest way to do this is to declare the UI objects in the Summary.ascx control as Public instead of protected.
0
 
JimDestructAuthor Commented:
Ok I kinda see what your coming from but havent dealt with public properties before so not sure how to go about it, can you show me what you mean?
0
 
JimDestructAuthor Commented:
p.s - I'm using VB.NET :)
0
 
Ted BouskillSenior Software DeveloperCommented:
Here is a sample from the Microsoft site: http://msdn2.microsoft.com/en-us/library/26db8ysc(VS.80).aspx

NOTE: You don't have to set the properties in the HTML tag.  You can do it in your code as well.
0
 
JimDestructAuthor Commented:
Excellent! OK I get how to set the public string but how then do you display the public string in the second ascx control?
0
 
JimDestructAuthor Commented:
Thanks for your help with this one, I managed to crack it!
0
All Courses

From novice to tech pro — start learning today.