locked
view state problem RRS feed

  • Question

  • User-2101450227 posted

    hi,

    how to pass a value from one page to another page in view state.

    please help me out.

    thanks for the help.

    Wednesday, October 22, 2014 5:35 AM

Answers

  • User-1716253493 posted

    viewstate only work in a page.

    I guess you need session variable or querystring

    http://msdn.microsoft.com/en-us/library/vstudio/75x4ha6s(v=vs.100).aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 22, 2014 5:48 AM
  • User724169276 posted

    You cant pass values between pages using viewstate , viewstates are page specific.Use other state management techniques. like Cookies,sessions,query strings.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 22, 2014 5:48 AM
  • User-1151753377 posted

    Hi immad,

    Welcome to the ASP.NET forum.

    how to pass a value from one page to another page in view state.

    Based on my understanding, you can access the viewstate variables across pages. This is only possible if Cross Page Posting or Server.transfer  is used to redirect the user to other page. If Response.redirect is used, then ViewState cannot be accessed across pages.

    Something like this:

    ViewState["Page1"] = "Page1 ViewState";
    Server.Transfer("AccessViewState.aspx");
    

    More information please access the link below:

    http://www.codeproject.com/Articles/37753/Access-ViewState-Across-Pages

     

    If you have any other questions, please feel free to post this forum.

    Best Regards,

    Summer

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 23, 2014 1:44 AM

All replies

  • User-1716253493 posted

    viewstate only work in a page.

    I guess you need session variable or querystring

    http://msdn.microsoft.com/en-us/library/vstudio/75x4ha6s(v=vs.100).aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 22, 2014 5:48 AM
  • User724169276 posted

    You cant pass values between pages using viewstate , viewstates are page specific.Use other state management techniques. like Cookies,sessions,query strings.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 22, 2014 5:48 AM
  • User-1151753377 posted

    Hi immad,

    Welcome to the ASP.NET forum.

    how to pass a value from one page to another page in view state.

    Based on my understanding, you can access the viewstate variables across pages. This is only possible if Cross Page Posting or Server.transfer  is used to redirect the user to other page. If Response.redirect is used, then ViewState cannot be accessed across pages.

    Something like this:

    ViewState["Page1"] = "Page1 ViewState";
    Server.Transfer("AccessViewState.aspx");
    

    More information please access the link below:

    http://www.codeproject.com/Articles/37753/Access-ViewState-Across-Pages

     

    If you have any other questions, please feel free to post this forum.

    Best Regards,

    Summer

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 23, 2014 1:44 AM