Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 22nd, 2005, 10:29 AM
Registered User
 
Join Date: Oct 2004
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default user control and code behind

Hi. I need to access a user control's property from another user control's code behind.

I have a .aspx page with two user controls
<myControl:uc1 id="uc1" runat="server"/>
<myControl:uc2 id="uc2" runat="server"/>

uc1 has a textbox called eventDate. I want to set that property from uc2's code behind.

Currently in uc1's code behind (uc1.vb) I have added:
Public Property myProp As String
  Get
  Return eventDate.Text
  End Get
  Set
  eventDate.Text = Value
  End Set
End Property

And then in uc2.vb I added:
dim ctlEdit as control=page.loadcontrol("uc1.ascx")

I then try set the property thru
ctlEdit.myProp="value"

I don't think I am loading uc1 correctly in uc2.vb.
I don't even know if I'm on the right track.

Any help is appreciated. Thank you in advanced.


 
Old February 23rd, 2005, 08:03 PM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cairo, , Egypt.
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000
Default

you have to use the page have the both controls as a bridge

Ahmed Ali
Software Developer




Similar Threads
Thread Thread Starter Forum Replies Last Post
user control code chroniclemaster1 ASP.NET 2.0 Professional 11 September 25th, 2008 03:53 PM
Add Windows User control in Web User Control agarwalvidhu C# 0 March 30th, 2006 01:17 AM
user control / code behind question whyulil General .NET 3 January 11th, 2005 11:17 AM
Loading user control dynamically from code-behind jacob ASP.NET 1.0 and 1.1 Basics 2 April 12th, 2004 06:06 PM
User Control / Code-behind ViagraFalls ASP.NET 1.0 and 1.1 Basics 3 November 1st, 2003 09:18 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.