newbie postback question about ASP controls

Discussion in 'ASP .Net' started by Jim Bancroft, Sep 24, 2004.

  1. Jim Bancroft

    Jim Bancroft Guest

    Do I understand correctly that my aspx webpage's DataGrid, Button and web
    control states are somehow stored in the "_VIEWSTATE" hidden input value,
    making it unneccesary to recreate their content in the case of page
    postbacks? Or are there gotchas I need to look out for in assuming these
    controls will work correctly, and have their former values available, after
    a postback?

    Thanks,

    Jim
    Jim Bancroft, Sep 24, 2004
    #1
    1. Advertising

  2. Hi Jim,

    You are correct for your server controls. The ones that start <asp:....>.
    You can also add your HTML control to the _VIEWSTATE by giving them the
    runat="Server" attribute. For example: <input type="hidden" id="hidValue"
    runat="server"> will add this control to view state and it will retain its
    value between postbacks. Good luck! Ken.

    --
    Ken Dopierala Jr.
    For great ASP.Net web hosting try:
    http://www.webhost4life.com/default.asp?refid=Spinlight

    "Jim Bancroft" <> wrote in message
    news:epGzj$...
    > Do I understand correctly that my aspx webpage's DataGrid, Button and web
    > control states are somehow stored in the "_VIEWSTATE" hidden input value,
    > making it unneccesary to recreate their content in the case of page
    > postbacks? Or are there gotchas I need to look out for in assuming these
    > controls will work correctly, and have their former values available,

    after
    > a postback?
    >
    > Thanks,
    >
    > Jim
    >
    >
    Ken Dopierala Jr., Sep 24, 2004
    #2
    1. Advertising

  3. Jim Bancroft

    Jim Bancroft Guest

    Thanks for the explanation and help, Ken! Good stuff below.

    -Jim


    "Ken Dopierala Jr." <> wrote in message
    news:%...
    > Hi Jim,
    >
    > You are correct for your server controls. The ones that start <asp:....>.
    > You can also add your HTML control to the _VIEWSTATE by giving them the
    > runat="Server" attribute. For example: <input type="hidden"

    id="hidValue"
    > runat="server"> will add this control to view state and it will retain its
    > value between postbacks. Good luck! Ken.
    >
    > --
    Jim Bancroft, Sep 24, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. NotYetaNurd
    Replies:
    1
    Views:
    457
    John Saunders
    Nov 7, 2003
  2. Psych971
    Replies:
    5
    Views:
    4,605
    bruce barker
    Dec 17, 2004
  3. Nathan Sokalski
    Replies:
    4
    Views:
    1,141
    Muhammad Naveed Yaseen
    Sep 5, 2007
  4. Dejan Vesic
    Replies:
    0
    Views:
    167
    Dejan Vesic
    Aug 20, 2003
  5. Wael_Bakr

    stop postback in postback events for server controls ??

    Wael_Bakr, Nov 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    496
    Wael_Bakr
    Nov 30, 2005
Loading...

Share This Page