Click here to Skip to main content
15,888,610 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to find project template Pin
DotNetXenon10-Dec-09 5:15
DotNetXenon10-Dec-09 5:15 
AnswerRe: How to find project template Pin
Dinesh Mani10-Dec-09 6:34
Dinesh Mani10-Dec-09 6:34 
GeneralRe: How to find project template Pin
DotNetXenon11-Dec-09 4:29
DotNetXenon11-Dec-09 4:29 
Questionto Dinesh Mani Pin
Munteanu Ciprian10-Dec-09 4:10
Munteanu Ciprian10-Dec-09 4:10 
AnswerRe: to Dinesh Mani Pin
Keith Barrow10-Dec-09 4:36
professionalKeith Barrow10-Dec-09 4:36 
AnswerRe: to Dinesh Mani Pin
Blue_Boy10-Dec-09 9:11
Blue_Boy10-Dec-09 9:11 
QuestionUpdating variables in Master Page Pin
Munteanu Ciprian10-Dec-09 3:10
Munteanu Ciprian10-Dec-09 3:10 
AnswerRe: Updating variables in Master Page Pin
Dinesh Mani10-Dec-09 3:30
Dinesh Mani10-Dec-09 3:30 
This has got nothing to do with the Master page! When you use master pages for headers and footers it just gives you a template for you to implement a common design for your header, footer, navigation, etc. The master page is not shared among pages, but each page gets a new object of the master page. So, by hard coding the value for the label in the master's mark-up you cannot achieve what you desire.

But, this is not so hard to achieve. Just have a session variable, if the clicks are user specific and on session start initialize it to 10 or what ever value you need. Then assign this value to the label on the master page. In the content pages, just update the value on the session variable and display the updated value on the master label

So your code can be re-written like this -

protected void Button1_Click(object sender, EventArgs e)
{
     int tries=Convert.ToInt32(Session["Tries"].ToString());
     if (tries>0)
     {
          Session["Tries"]=--tries;
          (Label)Master.FindControl("Label1").Text=tries.ToString();
     }
}

GeneralRe: Updating variables in Master Page Pin
Munteanu Ciprian10-Dec-09 3:34
Munteanu Ciprian10-Dec-09 3:34 
GeneralRe: Updating variables in Master Page Pin
Dinesh Mani10-Dec-09 6:27
Dinesh Mani10-Dec-09 6:27 
QuestionRegEx,match number 1-24 [modified] Pin
cyhcyhhychyc10-Dec-09 2:52
cyhcyhhychyc10-Dec-09 2:52 
AnswerRe: RegEx,match number 1-24 Pin
Dinesh Mani10-Dec-09 3:05
Dinesh Mani10-Dec-09 3:05 
QuestionASP.Net Performance Pin
Amit Patel198510-Dec-09 2:26
Amit Patel198510-Dec-09 2:26 
AnswerRe: ASP.Net Performance Pin
Abhijit Jana10-Dec-09 2:32
professionalAbhijit Jana10-Dec-09 2:32 
AnswerRe: ASP.Net Performance Pin
Abhishek Sur10-Dec-09 3:03
professionalAbhishek Sur10-Dec-09 3:03 
GeneralRe: ASP.Net Performance Pin
farogh haider14-Dec-09 19:33
farogh haider14-Dec-09 19:33 
QuestionError: missing parameter values when passing parameter in crystal report Pin
I'm a beginner10-Dec-09 0:35
I'm a beginner10-Dec-09 0:35 
AnswerRe: Error: missing parameter values when passing parameter in crystal report Pin
Alliance11115-Feb-10 0:13
Alliance11115-Feb-10 0:13 
Questionproblem sending mail Pin
m@dhu10-Dec-09 0:31
m@dhu10-Dec-09 0:31 
AnswerRe: problem sending mail Pin
Dinesh Mani10-Dec-09 0:40
Dinesh Mani10-Dec-09 0:40 
GeneralRe: problem sending mail Pin
m@dhu10-Dec-09 0:53
m@dhu10-Dec-09 0:53 
GeneralRe: problem sending mail Pin
Dinesh Mani10-Dec-09 0:58
Dinesh Mani10-Dec-09 0:58 
GeneralRe: problem sending mail Pin
m@dhu10-Dec-09 19:41
m@dhu10-Dec-09 19:41 
GeneralRe: problem sending mail Pin
Dinesh Mani10-Dec-09 19:44
Dinesh Mani10-Dec-09 19:44 
GeneralRe: problem sending mail Pin
m@dhu10-Dec-09 20:22
m@dhu10-Dec-09 20:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.