469,898 Members | 1,408 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

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 2951
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by WayDownUnder | last post: by
9 posts views Thread by J055 | last post: by
6 posts views Thread by =?Utf-8?B?SmF5IFBvbmR5?= | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.