473,395 Members | 1,996 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,395 software developers and data experts.

How To: Set Label Text Property In Master Page (From Subscribing Page)?

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. That works fine. However, when trying to set the
text property, I can see there is no "Text" property. So I thought a
cast would work...

((Label)(this.Master.FindControl("lblMyLabel")).Te xt = "My Text";

....but when I do this nothing happens. No error...just nothing.

What am I doing wrong?

JP

May 22 '07 #1
2 2027
"Joey" <jo*********@topscene.comwrote in message
news:11**********************@z24g2000prd.googlegr oups.com...
((Label)(this.Master.FindControl("lblMyLabel")).Te xt = "My Text";
That should certainly work...
...but when I do this nothing happens. No error...just nothing.
Are you maybe clearing the property later...?

If you put a breakpoint on the line in question, do you see the value of the
property change...?

Alternatively, do you have more than one MasterPage...?
--
http://www.markrae.net

May 22 '07 #2
On May 22, 10:22 am, "Mark Rae" <m...@markNOSPAMrae.netwrote:
"Joey" <joey.pow...@topscene.comwrote in message

news:11**********************@z24g2000prd.googlegr oups.com...
((Label)(this.Master.FindControl("lblMyLabel")).Te xt = "My Text";

That should certainly work...
...but when I do this nothing happens. No error...just nothing.

Are you maybe clearing the property later...?

If you put a breakpoint on the line in question, do you see the value of the
property change...?

Alternatively, do you have more than one MasterPage...?

--http://www.markrae.net
I did not have the code in the Page_PreRender event handler. After I
moved it there, it worked.

May 23 '07 #3

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

Similar topics

3
by: Mike Johnson | last post by:
I'm new to VB.Net and programming. I just brought VB.Net Standard I'm working on a small program for work. I've created two forms the first is named Forms1 and the second is named SettingsForm on...
3
by: Mike Johnson | last post by:
Thanks for the quick responses. I'm having trouble understanding. I've included the code I using. perhaps someone can tell me what I'm doing wrong. My original question was, I'm new to VB.Net...
4
by: Rik Brooks | last post by:
OK, now I'm getting excited. I actually created a master page and added two content place holders to it. I also added a label which will serve as a sort of one line help and a little image button...
5
by: fripper | last post by:
I want to add a symbol (in this case the symbol for Pi) in the middle of the text property of a label control. I cannot figure out how to do this ... can someone point me in the right direction? ...
4
by: NetGoofy | last post by:
Is there a way to change the Value of a Label.Text Property outside an Application, such as the contents of a data.txt file or ini file or something like that. I would like to be able to change...
1
by: SteveT | last post by:
Folks, I am reading/writing data within an XML file. In my form I have a label that is assigned to the UpdateDate field within the XML file. Within the form I update the label to a different...
3
by: Caryn Graves | last post by:
Hello. So I've got this web page written in ASP, which has some text and graphics, and I need to add a feature to the page whereby a user could select from among a list of fax numbers, and send a...
3
by: Nick | last post by:
Hi ALL: i have a master page and two sub pages and master page has a menu with two links which point to two sub page. what i wanna to do is that when the sub page shows the link in the menu...
4
by: moondaddy | last post by:
I have a htm page where I need to pass some data to an aspx page as a means of sending data to the database. I don't need to see the aspx page so I was going to put it in a hidden iframe. This...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.