Last post Nov 11, 2010 04:40 AM by alpesh patel
Nov 07, 2010 11:27 PM|tsfroggy|LINK
I am converting a 1.1 .NET web app to 3.5, and I've run into a bit of a jam.
One web control has a Property that sets the page title label on that web control.
When a page with the web control was loaded before, it would set the Property to a given string, like in ucHeader.PageTitle = "This is a string." Now, if I don't remove the lblPageTitle.Text = Value, I get a NullReference Exception. Anyone have any ideas?
Nov 11, 2010 04:18 AM|Shengqing Yang - MSFT|LINK
From the code above, I am afraid we cannot find the issue. And I am sure I get the word "the page title label". What did you mean by that? The page's title attribute or a Label's Text property?
Also, I have another three questions based on your code:
1. What is the lblPageTitle in your code. Is it a Label?
2. What kind of control is this web control?
3. Why you are trying to access another control's property in this web control?
Anyway, have a try to find the lblPageTitle before you going to access it via FindControl() method and you can set a breakpoint to see what happens when you trying to set a value to the PageTitle property.
For more information about FindControl method, please refer to:
Nov 11, 2010 04:40 AM|Alpesh Patel|LINK
Check before assign value to lable that, page is rendered fully bafore assign value.