943,929 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 676
  • C# RSS
May 14th, 2009
0

Update website control from usercontrol?

Expand Post »
Hi..

I am trying to update a webcontrol on a main site from a usercontrol but how can this be done.

Let's say I want to update an asp:textbox from a usercontrol on the page, but how is this done most respectfully. The usercontrol does ofcause not know the controls from the main site but I guess that the "findcontrol"-method (in the usercontrol) executed on the parent-control must do what I need (as long that I check that the control exist on the main page); but how is this done.

Something like this maybe:
MAIN SITE:
<SOME TEXTBOX id="main">
<uc:USERCONTROL id="UC">

USERCONTROL codebehind somewhere:
((Textbox)This.parent???.findcontrol("main")).Text = "something from uc";
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
sniper1983 is offline Offline
30 posts
since Nov 2007
May 15th, 2009
0

Re: Update website control from usercontrol?

I think ASP.NET forum http://www.daniweb.com/forums/forum18.html can answer but I'll give a solution
if UserControl has property = "something from UC" you can from the page holds the Usercontrol say textbox.Text = UC.PropertyName; and it's the correct the usercontrol should have no information about the page it's in. but the page should have.
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
May 15th, 2009
0

Re: Update website control from usercontrol?

Thanks.. Ofcourse I should have asked in the asp.net section..
Reputation Points: 10
Solved Threads: 0
Light Poster
sniper1983 is offline Offline
30 posts
since Nov 2007
Aug 13th, 2009
0

Re: Update website control from usercontrol?

thanks so much for useful info
SNIP
Last edited by happygeek; Aug 14th, 2009 at 6:03 am. Reason: fake sig snipped
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mcjohn87 is offline Offline
2 posts
since Aug 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: C# code to deny access to local hard disk drives
Next Thread in C# Forum Timeline: Property Grid Problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC