Click here to Skip to main content
15,920,632 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Frnds,

I have developed one Master page and one web form.. i clicked masterpage linkbutton then i want one label visible false in web form..



With Regards,
Vivek .R
Posted

U have to use javascript __doPostback method onclientclick of link button and at the time of pageload of your web form not master page, u have to handel your code given as below

@ master Page

lnkBtn.OnClientClick="__doPostBack('_masterClick','');";


@ web Form

protected void Page_Load(object sender,Eventargs e)
{
if(Request["__EVENTTARGET"] == "_masterClick")
{
// Your Logic...
}
}
 
Share this answer
 
use Find Control Method to handel this

Label lbl= (Label)Master.FindControl("lbl");
 
Share this answer
 
v2
Use state management techniques like sessions, cookies etc.On click event of master page set values of state management variable & check it on page load event of web form .According to its value perform your operations.
 
Share this answer
 
Try this code
C#
mLabel =
    (Label)Master.FindControl("LabelId");
  if(mLabel != null)
  {
    mLabel.Visible=False;
  }
 
Share this answer
 
Comments
Member 10611310 24-Feb-14 7:39am    
am no need master label visible false.. i need another form label visible false from master linkbutton
R-a-v-i-k-u-m-a-r 24-Feb-14 7:47am    
Sorry. I couldn't understand your question. You want to hide the label which was in anthor web form. right?
Member 10611310 24-Feb-14 7:51am    
s..sure...
R-a-v-i-k-u-m-a-r 24-Feb-14 7:54am    
Then you can use cross pageposting. check the following link
http://www.codeproject.com/Articles/14092/Cross-Page-Posting-in-ASP-NET-2-0

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900