Replies |
Ndebata
Posted on: 5/27/2011 3:24:57 AM
|
Level: Starter | Status: [Member] | Points: 50
|
 Hi
Just try to add a property in master page that will expose the label.text
lets say the ID of label in master page is lblinMaster public String LabelValue
{
get { return lblinMaster.Text; }
}
Then add a refernece to your master in the content page where you are using the master.
<%@ MasterType VirtualPath="~/MasterPage.master" %>
Then in content page you can access
Master.LabelValue
Thanks,
Debata
Prabhakar, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Lakn2
Posted on: 5/27/2011 3:31:37 AM
|
Level: Starter | Status: [Member] | Points: 25
|
refer the below link
http://www.eggheadcafe.com/tutorials/aspnet/969a11b2-a5a4-4a51-852a-003fd40bbd68/access-master-page-control-from-content-page.aspx
Thanks&Regards
LakshmiNarayana Nalluri.
Prabhakar, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Bugwee
Posted on: 5/27/2011 3:34:24 AM
|
Level: Starter | Status: [Member] | Points: 25
|
Prabhakar, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Prabhakar
Posted on: 5/27/2011 3:35:09 AM
|
Level: Starter | Status: [Member] [MVP] | Points: 25
|
Hi Ndebata
thanku fro responding . . but u write code but i write in child page for fetch it value
Best Regard's
Prabhakar
Prabhakar, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Ndebata
Posted on: 5/27/2011 3:37:55 AM
|
Level: Starter | Status: [Member] | Points: 25
|
Hi Prabhakar,
In the content page you can use Master.LabelValue.
Child page is same as content page in my post (Modified the English :) ).
Thanks,
Debata
Prabhakar, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Bugwee
Posted on: 5/27/2011 3:40:11 AM
|
Level: Starter | Status: [Member] | Points: 25
|
Prabhakar, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Prabhakar
Posted on: 5/27/2011 3:45:04 AM
|
Level: Starter | Status: [Member] [MVP] | Points: 25
|
hi ndebata
i am use like this . .
string ram = Master.LabelValue.ToString();
my label on master page fill but on content page he return null value
Best Regard's
Prabhakar
Prabhakar, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
 Hi
Please find the attached code and check it against yours, its working.
Thanks,
Debata
Prabhakar, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Prabhakar
Posted on: 5/27/2011 4:11:02 AM
|
Level: Starter | Status: [Member] [MVP] | Points: 25
|
Hi Ndebata
thanku for code . . it's working fine . . i am little bit confuse . but now i slove it . . i am using cookies . .
it's working
public string LabelValueimgssnofrom
{
get { return HttpContext.Current.Request.Cookies["imgssnofrom"].Value.ToString(); }
} Best Regard's
Prabhakar
Prabhakar, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Ndebata
Posted on: 5/27/2011 4:16:23 AM
|
Level: Starter | Status: [Member] | Points: 25
|
But Cookies may not be good in some context like browser can refuse cookies. :)
Thanks,
Debata
Prabhakar, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Hi Prabhakr,
Assign value to label in Master Page Page_Init event instead of Page_Load Event
y bcz u are accessing Master Page Label value before firing page_load event of the MasterPage.
the u access when ever u want the the Master page Label in ur code
Master Page
protected void Page_Init(object sender, EventArgs e)
{
LabelValue="xyz";
}
public string LabelValue
{
get { return this.lblfrom.Text; }
set { this.lblfrom.Text = value; }
}
Other Page abcd.aspx
string mpLabel = ((Label) Master.FindControl("lblfrom")).Text;
it works for me ..!
Prabhakar, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|