Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access a H1 tag inside the parent master page thru a content page

Posted on 2011-09-23
3
Medium Priority
?
542 Views
Last Modified: 2012-05-12
I have a H1 tag in the body of my Parent Master Page. My content page is based on nested master page. I am trying to access the H1 tag in this content page using the code behind.

My site it built in asp.net 2.0 and C#.

In the Page_Load of my content page I am trying to access it like this>

HtmlGenericControl h1 = (HtmlGenericControl)Master.Master.FindControl("h1top");
                    h1.InnerText = "this is a test";

Open in new window


Didn't work throws an error


System.NullReferenceException: Object reference not set to an instance of an object.
   at mysite.product.Page_Load(Object sender, EventArgs e) in http://server/TestsiteLatest/browse/product.aspx.cs:line 102

line 102 is h1.InnerText = "this is a test";

where am i making an error in writing the code.

Thanks and appreciate it
0
Comment
Question by:niceoneishere
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Accepted Solution

by:
Eyal earned 750 total points
ID: 36594336
see this page for detailed instructions of how to do this

http://msdn.microsoft.com/en-us/library/c8y19k6h.aspx
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 750 total points
ID: 36599409
In order to use FindControl, the element needs the runat="server" attribute.  I wouldn't think that the <h1> element would have that.
0
 
LVL 1

Author Closing Comment

by:niceoneishere
ID: 37017923
thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question