Update website control from usercontrol?

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2007
Posts: 28
Reputation: sniper1983 is an unknown quantity at this point 
Solved Threads: 0
sniper1983 sniper1983 is offline Offline
Light Poster

Update website control from usercontrol?

 
0
  #1
May 14th, 2009
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";
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Update website control from usercontrol?

 
0
  #2
May 15th, 2009
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.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 28
Reputation: sniper1983 is an unknown quantity at this point 
Solved Threads: 0
sniper1983 sniper1983 is offline Offline
Light Poster

Re: Update website control from usercontrol?

 
0
  #3
May 15th, 2009
Thanks.. Ofcourse I should have asked in the asp.net section..
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 2
Reputation: mcjohn87 is an unknown quantity at this point 
Solved Threads: 0
mcjohn87 mcjohn87 is offline Offline
Newbie Poster

Re: Update website control from usercontrol?

 
0
  #4
Aug 13th, 2009
thanks so much for useful info
SNIP
Last edited by happygeek; Aug 14th, 2009 at 6:03 am. Reason: fake sig snipped
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC