0

Hi,

I have a really basic ASP.Net question regarding the life of variables. I'm following the book Beginning ASP.Net 4 by Apress.

The question is this, I declare a list in the .aspx page and it is available for access by the corresponding .aspx.cs class similar to the code sample below.

<select ID="Currency" runat="server" />
protected void Page_Load(Object sender, EventArgs e)
{
            if (this.IsPostBack == false)
            {
                Currency.Items.Add(new ListItem("Euros", "0.85"));
                Currency.Items.Add(new ListItem("Japanese Yen", "110.33"));
                Currency.Items.Add(new ListItem("Canadian Dollars", "1.2"));

                //hiding the image
                Graph.Visible = false;
            }
        }

How is it that the server is aware of which ListItem I have selected for processing by the page? Where is the ListItem selected stored?

Thanks

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by dnanetwork
0

>How is it that the server is aware of which ListItem I have selected for processing by the page?

No! server is not preserving the state (data) of ASP.NET server controls.

>Where is the ListItem selected stored?

Every ASP.NET server control is devised with "ViewState" mechanism which saves the state of every changed property.

0

select your HTML page view source before selecting and
select your HTML page view source after selecting

you'll have the answer.

This topic has been dead for over six months. 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.