473,769 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("H eader1"), HeaderControl)
pageHeader.Titl e = "Error"

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

Jan 3 '06 #1
3 2117
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("H eader1"), HeaderControl)
pageHeader.Titl e = "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
1690
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 calendar. When a value in the calendar is selected it posts back and then updates a public property (CurrentDate) on the UC. Note that 2 postbacks occur. I have been attempting to access the public property on the UC, from the page (testCal) shown...
4
1885
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 Inherits="CodeBehindSimple" src="simple.vb" %> <%@ Register TagPrefix="CC" TagName="Simple" Src="ucSimple.ascx"%>
5
1517
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 page... <%@ Register TagPrefix="dI2" TagName="dartsUC_rolodexsearch" Src="dartsUC_rolodexsearch.ascx" %>
3
1644
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 set the add/edit/delete options visble/invisible on the datagrid depending on the users's role, but found that i cannot access the grid to do this. is the only way of setting it in the page load of the usercontrol itself?
1
1210
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 follows : '******************************** Private sLinkType As String
1
6870
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 and page loading/rendering lifecycle.... Ok, now for the question: I have an ASPX page (page.aspx), and I have a UserControl (control.ascx). The UserControl has one textbox on the control, and one button control. I have added a public property...
3
1622
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 properties setup but I dont know how to access that use control... Thanks!! David
3
3041
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"> <SelectParameters> <asp:ProfileParameter Name="user" PropertyName="UserName"
9
2651
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 to another location because it populates a Textbox in the user control page. Thanks Andrew
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.