how to set the property of the a control in master page.

Last post 01-19-2009 1:51 AM by aammiz. 5 replies.

Sort Posts:

  • how to set the property of the a control in master page.

    01-14-2009, 2:26 PM
    • Member
      405 point Member
    • aammiz
    • Member since 08-10-2004, 5:02 PM
    • Posts 444

     Hi I have master page and its childern pages.

    For instance, if i have a label on the master page. 

    I want to set its text property from the child page. how I can do that.  ?

    learning.. : )
    Filed under:
  • Re: how to set the property of the a control in master page.

    01-14-2009, 3:19 PM
    Answer
    • Contributor
      2,172 point Contributor
    • JMayo
    • Member since 02-23-2007, 4:13 AM
    • Denver, CO
    • Posts 283
    • TrustedFriends-MVPs

    Hi,

    Try this:

                Label label1 = Master.FindControl("Label1") as Label;
                label1.Text = "Hello";
    

     Joe

  • Re: how to set the property of the a control in master page.

    01-15-2009, 8:37 AM
    Answer
    • Participant
      863 point Participant
    • nitindhiman
    • Member since 12-27-2007, 4:41 PM
    • chandigarh, india
    • Posts 144

     hi,

    you can do it following way:


            Label lbl= (Label)this.Master.FindControl("controlId");
            lbl.Text = "new text";

    Nitin Dhiman....!!!!
    Please Mark Answer If Helped....!!!!
  • Re: how to set the property of the a control in master page.

    01-15-2009, 9:24 PM
    Answer
    • Member
      405 point Member
    • aammiz
    • Member since 08-10-2004, 5:02 PM
    • Posts 444

    is this to get the value  from master page or to assign the  value to a control in master page?

    Where is this label located? 

    learning.. : )
  • Re: how to set the property of the a control in master page.

    01-19-2009, 1:46 AM
    Answer

    aammiz:

    is this to get the value  from master page or to assign the  value to a control in master page?

    Where is this label located? 

    Not sure what do you want, it seems that you want to know how to get(set) value from(to) a control,

    Get:
    Label label1 = Master.FindControl("Label1") as Label;
    string strGetValue = label1.Text;

    Set:
    Label label1 = Master.FindControl("Label1") as Label;
    label1.Text = "Set Value";


     

     

    Hong-Gang Chen
    Microsoft Online Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Re: how to set the property of the a control in master page.

    01-19-2009, 1:51 AM
    • Member
      405 point Member
    • aammiz
    • Member since 08-10-2004, 5:02 PM
    • Posts 444

    thanks for all your help 

    learning.. : )
Page 1 of 1 (6 items)