Saturday, March 24, 2012

pass vaules between user control (ascx) and aspx page?

Any one have examples or links of how to pass vaules between user control (ascx) and aspx page?

I've been able to pass a value from an aspx page to a user control called in it by adding the variable name = "somevalue" inside the user control tag.

But now I want to have a value from a user control's textbox after a button is clicked, availble to the aspx page.

This seems so simple... and yet I am so lost :)Hi,

In the user Control you can make public properties that will return the string writtin in the TextBox of User Control.

And then in the webform.apsx page you can make an instance of the UserControl and use that property to get the value which is returned from the TextBox.
Thank you!

I did a search on google for those terms and found this article ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconexposingpageletproperties.asp ), and it looks like it goes into detail on public properties of a user control.

Thanks. :)
Am I missing something?
Can the user control properties only be changed from the page that calls the user control, is it possible the other way around, so that in the user control the properties are changed and the page that calls the uc can access those? Two way street or only one way? :)

0 comments:

Post a Comment