0
    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? @@

2
Contributors
4
Replies
9
Views
3 Years
Discussion Span
Last Post by gahhon
0

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.

Edited by JorgeM

0

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?

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.