JimDestruct
asked on
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?
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?
So the search form captures the information and the summary displays it?
ASKER
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
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.
ASKER
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?
ASKER
p.s - I'm using VB.NET :)
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.
NOTE: You don't have to set the properties in the HTML tag. You can do it in your code as well.
ASKER
Excellent! OK I get how to set the public string but how then do you display the public string in the second ascx control?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help with this one, I managed to crack it!