473,411 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Accessing UserControl Property from Page

Ok.. Here it goes.

I have a MasterPage that includes a UserControl (HeaderControl.ascx)
that has the ID of Header1 in the markup in the Master Page. Now, the
Head1 usercontrol has a property called Title.

Then, I have a Test.aspx page that uses the Masterpage and I want to be
able to acces the Title Property of the Header1 user control that is in
the MasterPage.

Here is what I am doing in the Page_Init in the Test.aspx:

Dim pageHeader As HeaderControl =
CType(Me.Master.FindControl("Header1"), HeaderControl)
pageHeader.Title = "Error"

This doesn't do anything. The title doesn't show up. Anyone have any
suggestions?

Jan 3 '06 #1
3 2100
I have done this by using a label server control in the user-control that is
defined as "Public Shared WithEvents"
Jan 3 '06 #2
Thanks. I have decided to do away with the header usercontrol and put
its content in the MasterPage itself. I was converting a 1.1 app to a
2.0 app and I figured I could take some shortcuts by re-using the
pre-existing usercontrols.

Jan 3 '06 #3
hmm...strange it should work. Make sure that the poperty in your user control
is not read only i.e it has both get and set.

"tdavisjr" wrote:
Ok.. Here it goes.

I have a MasterPage that includes a UserControl (HeaderControl.ascx)
that has the ID of Header1 in the markup in the Master Page. Now, the
Head1 usercontrol has a property called Title.

Then, I have a Test.aspx page that uses the Masterpage and I want to be
able to acces the Title Property of the Header1 user control that is in
the MasterPage.

Here is what I am doing in the Page_Init in the Test.aspx:

Dim pageHeader As HeaderControl =
CType(Me.Master.FindControl("Header1"), HeaderControl)
pageHeader.Title = "Error"

This doesn't do anything. The title doesn't show up. Anyone have any
suggestions?

Jan 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Iain | last post by:
Hi I have page (testCal.aspx) that contains a usercontrol (custCalendar.ascx) - see below signature for code. The UC contains a linkbutton which which when clicked, posts back and displays a...
4
by: Mat | last post by:
Hi, I am having a bit of a problem trying to access / set properties of a usercontrol from the parent codebehind. This is what I have so far.. simple.aspx <%@ Page...
5
by: Dan Nash | last post by:
Hi all, I've got a page with a user control on, added via VS. I'm trying to get to a property of the user control (or more precisely, a public var). Here's the code at the top of my aspx...
3
by: Craig G | last post by:
i have a user control which is basically a datagrid, which has add/edit/delete buttons on the grid is there anyway of accessing the actual datagrid from the form itself? basically i want to...
1
by: Chowny | last post by:
I am fairly new to ASP .NET, and am busy teaching myself as I work through my current project. I'm a bit stumped at the moment. I have made a usercontrol called "RelatedClaims" . The code as...
1
by: Will Gillen | last post by:
I know this has probably been asked before, but I can't seem to find a solid answer in any of the archives. First, before my question, please forgive my limited knowledge of the event lifecycle...
3
by: David Lozzi | last post by:
Howdy, I'm using a PlaceHolder to dynamically display a user control based on a users selection. This part works great. However how do I get to the properties of that user control? I have public...
3
by: Jeff | last post by:
Hey ASP.NET 2.0 This the ObjectDataSource in my UserControl, <asp:ObjectDataSource ID="odsMessage" runat="server" SelectMethod="ExecuteMessage" TypeName="AH.MyNetwork.BLL.Network.Message">...
9
by: J055 | last post by:
Hi I have a standard asp page which uses a MasterPage. The MasterPage contains a User control. How can I access a public method in the User control from my WebForm page? I can't move the method...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.