?
Solved

Read Variable from content page, declared in masterpage

Posted on 2010-01-11
4
Medium Priority
?
543 Views
Last Modified: 2013-11-26
Hello people, I would like to know if someone can help me with a little problem.
I did a masterpage, and I declared somes variables with a value.

I want to access to those variables from a content page.

How I can do it?

Thanks
0
Comment
Question by:nkoriginal
[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
4 Comments
 
LVL 11

Expert Comment

by:rajvja
ID: 26283173
Site masterpage = Page.Master as Site
masterpage.variablename

http://www.asp.net/(S(sf10gzjodvrpce55el2p5cnk))/learn/master-pages/tutorial-06-cs.aspx
0
 
LVL 20

Accepted Solution

by:
informaniac earned 2000 total points
ID: 26283183
U'll have to declare public properties in the master page to access the values in a content page.

http://msdn.microsoft.com/en-us/library/xxwa0ff0.aspx
0
 
LVL 10

Expert Comment

by:krunal_shah
ID: 26283204
Hi,

you can assign that variable to asp  hidden field in master page and access that hidden field in the content page as shown in this example ( it access the text box control of the master page),

http://msdn.microsoft.com/en-us/library/xxwa0ff0.aspx

Thanks,
Krunal
0
 
LVL 7

Expert Comment

by:waltersnowslinarnold
ID: 26283249
You can do as below..

Master.FindControl("controlName");
0

Featured Post

How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 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