ASP.Net master page and content page
I have a login screen in the content page ,Aftre login the values should go to the Master page on the Label.
please give some solution

Recommended Answers

All 4 Replies

Member Avatar for stbuchok

Singleton object
Store in database for retrieval
On page load get the MasterPage object and use FindControls

Any of those should be able to do it.

This may also help you:

You can call the contentpage value in the masterpage as follows:

        Label lb = (Label)ContentPlaceHolder1.FindControl("label1");

Where label1 is the label in the content page and textbox1 is a textbox in the masterpage...

Create an instance of the Master page, find the control on master page and do what you need to do ... don't make it overy complicated.

In the example below I have a label on the master page called "lblMasterPageLabel".
In the content page that is referencing the master page I can write to that label like this:

        MasterPage mp = new MasterPage();
        mp = Master;

        Label lb = (Label)mp.FindControl("lblMasterPageLabel");
        lb.Text = "Found It";`
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.