473,473 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Making a public property in a master page is not visible in .aspxpage

Hi,

I have a .aspx page that has a master page.

In the master page, I have a Literal Control, and I created a public
property that allows you to set the liBlah.Text of the literal
control.

The idea was that the .aspx page could simple use the property to set
the value of the literal, but for some reason the property is not
showing up in the intellisense of the .aspx page.

Did I do something wrong?

Do I have to use a findcontrol or somethign?
Jan 29 '08 #1
4 3090
On Jan 29, 3:08*pm, DotNetNewbie <snowman908...@yahoo.comwrote:
Hi,

I have a .aspx page that has a master page.

In the master page, I have a Literal Control, and I created a public
property that allows you to set the liBlah.Text of the literal
control.

The idea was that the .aspx page could simple use the property to set
the value of the literal, but for some reason the property is not
showing up in the intellisense of the .aspx page.

Did I do something wrong?

Do I have to use a findcontrol or somethign?
Add the following page directive to the top of the page your trying to
access your master page from.

<%@ MasterType virtualPath="~/myMasterPageName.master" %>

Now you should be able to access all your maspter page properties and/
or methos via "Master.Method()" etc.

NB
Jan 29 '08 #2

you need to cast it.

((MyMaster)Master).MyProperty ....

HTH,

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Tue, 29 Jan 2008 15:08:45 -0800 (PST), DotNetNewbie
<sn***********@yahoo.comwrote:
>Hi,

I have a .aspx page that has a master page.

In the master page, I have a Literal Control, and I created a public
property that allows you to set the liBlah.Text of the literal
control.

The idea was that the .aspx page could simple use the property to set
the value of the literal, but for some reason the property is not
showing up in the intellisense of the .aspx page.

Did I do something wrong?

Do I have to use a findcontrol or somethign?
Jan 30 '08 #3
Both method suggested by NvrBst and Samuel works. I'll suggest you use
NvrBst's suggestion, I always prefer that cos it's type safe and you can
escape runtime issues.

"DotNetNewbie" <sn***********@yahoo.comwrote in message
news:20**********************************@c23g2000 hsa.googlegroups.com...
Hi,

I have a .aspx page that has a master page.

In the master page, I have a Literal Control, and I created a public
property that allows you to set the liBlah.Text of the literal
control.

The idea was that the .aspx page could simple use the property to set
the value of the literal, but for some reason the property is not
showing up in the intellisense of the .aspx page.

Did I do something wrong?

Do I have to use a findcontrol or somethign?

Jan 30 '08 #4
On Jan 30, 10:23 am, "Onawole Clement Oladapo"
<dapo.onaw...@gmail.comwrote:
Both method suggested by NvrBst and Samuel works. I'll suggest you use
NvrBst's suggestion, I always prefer that cos it's type safe and you can
escape runtime issues.

"DotNetNewbie" <snowman908...@yahoo.comwrote in message

news:20**********************************@c23g2000 hsa.googlegroups.com...
Hi,
I have a .aspx page that has a master page.
In the master page, I have a Literal Control, and I created a public
property that allows you to set the liBlah.Text of the literal
control.
The idea was that the .aspx page could simple use the property to set
the value of the literal, but for some reason the property is not
showing up in the intellisense of the .aspx page.
Did I do something wrong?
Do I have to use a findcontrol or somethign?
My page is already referencing the master page.

This is how it does it, in the codebehind instead of inheriting from
system.web.ui.page I inherit from MyCustomPage

And in MyCustomPage I set the masterpage.

That should be the exact same as if I was using the directive <%@ %>
tag right?
Jan 30 '08 #5

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

Similar topics

3
by: CSDunn | last post by:
Hello, I currently have an Access 2003 ADP Report/Subreport set up in which I have 12 subreports in a single main report that are located in a group header called 'PermnumHeader' (Permnum would be...
2
by: Matthew Louden | last post by:
In ASP, if I have asppage.asp for GUI and aspprocess.asp for process requests from database. In asppage.asp code will be like: <form action="aspprocess.asp" method="POST"> GUI CODE </form> ...
7
by: WayDownUnder | last post by:
Hello I am having trouble accessing a public porperty that my master page exposes I try to access it in a content page but the property is not visible through intell sense. Master Page...
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...
2
by: Joey | last post by:
asp.net 2/C#/VS2005 How do i set the text property for a label control on my master page? I am able to use... this.Master.FindControl("lblMyLabel").Visible = false; ....to hide the label....
13
by: Kirk | last post by:
I have been reading Scott Allen's article on Master Pages (http:// odetocode.com/Articles/450.aspx) but I am having problems understanding a concept. Specifically, I have created a property...
6
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
I am trying to access a Public property on a Master Page from a Base Page. On the content pages I have the MasterType Directive set up as follows: <%@ MasterType virtualpath="~/Master.master" %>...
1
by: NotTooSerious | last post by:
Hi I have just upgraded a project from 2005 net 2.0 frame work to 2008 net 3.5 frame work On the (single not nested) master page I have a lable which is wrapped in a public sub to set its text and...
1
by: Ex glider pilot | last post by:
Hi I have a public property on a master page: Public Sub SetTitle(ByVal TitleText As String) Me.lblMessage.Text = TitleText End Sub the page def of the content page is: <%@ Page...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
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
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,...
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...
0
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...
0
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 ...

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.