p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Basics (http://p2p.wrox.com/forumdisplay.php?f=136)
-   -   Posting data from Control to Page (http://p2p.wrox.com/showthread.php?t=26513)

bmains March 7th, 2005 04:34 PM

Posting data from Control to Page

I'm trying to post data from a user control to a page. I can access the data sure enough, but the problem I am now having is the fields are blank. I can't retrieve any of the fields defined in the user control in the posted to page. To give you a scenario, I have two pages search.aspx and view.aspx, which both post to searchresults.aspx. view.aspx has a user control that posts the user control data to searchresults.aspx page using PostBackUrl.

So it posts back to the page fine, but IsCrossPagePosted is false and there isn't any fields in the control.

Any ideas? Thanks,


liberty2k December 6th, 2005 08:08 PM

Whenever you have controls within a User Control, you should remember to traverse the control hierarchy properly to access the controls. You may have to do something like this:

((TextBox)Page.PreviousPage.FindControl("MyUserCon trol").FindControl("EmbeddedTextBoxControl)).Text

All times are GMT -4. The time now is 12:53 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.