Sunday, 17 August 2014

How To Get Viewstate Value From One Page To Another Page In Asp.Net

Hello Everyone,

Now I am tell you about viewstate. to get value of viewstate from another page using StateBag Class.

Lets example there is two page 1) First.aspx 2) Second.aspx
where we set viewstate value in First.aspx on some button click and then redirect to Second.aspx where we get value of viewstate which we set in Frist Page.

1) Button Click in First.aspx (.cs file Code)

protected void button_Click(object sender, EventArgs e)
           // Set Viewstate Value
          ViewState["Name"] = "Chetan" ;