Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have a master page that has some control and on page load event of child page i am not getting value of master page control but same I am getting on click event of button.

Please help.

Mohd wasif
Posted
Updated 3-Oct-11 21:27pm
v2
Comments
jim lahey 4-Oct-11 3:28am    
you'll need to post an example.

1 solution

C#
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        TextBox txt = (TextBox)this.Page.Master.FindControl("txtMastValue");
        if (txt != null)
            Response.Write(txt.Text);
    }
}



Above if you see..

I have place a textbox on the master page with some value
and i have accessed the same on the child page with find control
 
Share this answer
 

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