public partial class Member : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["Username"] != null)
                lblUsername.Text = Request.QueryString["Username"];
        }

        public string getUsername
        {
            get { return lblUsername.Text; }
        }
    }
}

This is when master page load will display Username to the lblUsername and it success to display.
But when i go to others child page will lost the master page lblUsername test. How Come? @@

Recommended Answers

All 4 Replies

Are you supplying the querystring on all "child" pages? If not, then as new pages load, there is no information in the query string to pull from as per your code logic.

The viewstate does not retain this value between different pages.

in fact, i am using <a href="#Child.aspx"/>
What should i do no need to keep transfer the parameter to other child page?
Just using a simplest code instead of do it multiple time?

in fact, i am using <a href="#Child.aspx"/>

I dont know what you mean by that code.

If you need to keep a value between pages, you'll need to resort to one of the common approaches such as storing the value in a session variable, cookie, database lookup etc...

I wouldnt recommend passing the value between pages using a query string.

I am using Cookies to store the value. Thanks for in advance.

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.