I'm relatively new to ASP.Net and I'm trying to get my head around the whole ViewState and PostBack concept. So I'm wondering if anyone can help me understand an abstract, high-level view of it all. I've read several recommended links on viewstate and postback, and I think I have a general understanding of what happens, but somehow I keep asking myself "why?".
To give a frame of reference, I'm used to classic asp with ajax. So for example, if I had a data grid to update, it was an html table generated in an asp page and viewd in an iframe. Then in javascript I'd copy the selected row (including a binary timestamp field) and send it via xmlhttprequest to an asp page that performed the update. If the timestamp was unchanged, but the passed-in field values differed from the db values, then the update is performed for those fields and a simple success message and the new binary timestamp is sent back--not an entire re-rendered page, not the entire grid, not evnen the row--because the db now has the same values that are onscreen. I'm not really thinking security here--the environment is internal and, for all intents and purposes, trusted.
So I'm getting pressure to move things to .Net, not just from powers-that-be, but honestly I'm starting to feel like classic asp is being treated like someone using DOS 5.0.
I guess I'm just not seeing the advantage in somehow saving the entire page in some hidden Viewstate field, schlepping that back to the server, and then re-rendering the entire page--whether it's a single record page or an entire grid. In addition--it's unclear to me why a hidden field is needed--if there's a Postback, why wouldn't the page just send the actual values in the field back and whatever needed to be done--ie, the reason the postback was called--could be done and those same values passed back.
Please excuse me if I seem dense on this, it's a new concept and it's hard for me to embrace it when I'm not seeing a real benefit.
Thanks,
--Jim
To give a frame of reference, I'm used to classic asp with ajax. So for example, if I had a data grid to update, it was an html table generated in an asp page and viewd in an iframe. Then in javascript I'd copy the selected row (including a binary timestamp field) and send it via xmlhttprequest to an asp page that performed the update. If the timestamp was unchanged, but the passed-in field values differed from the db values, then the update is performed for those fields and a simple success message and the new binary timestamp is sent back--not an entire re-rendered page, not the entire grid, not evnen the row--because the db now has the same values that are onscreen. I'm not really thinking security here--the environment is internal and, for all intents and purposes, trusted.
So I'm getting pressure to move things to .Net, not just from powers-that-be, but honestly I'm starting to feel like classic asp is being treated like someone using DOS 5.0.
I guess I'm just not seeing the advantage in somehow saving the entire page in some hidden Viewstate field, schlepping that back to the server, and then re-rendering the entire page--whether it's a single record page or an entire grid. In addition--it's unclear to me why a hidden field is needed--if there's a Postback, why wouldn't the page just send the actual values in the field back and whatever needed to be done--ie, the reason the postback was called--could be done and those same values passed back.
Please excuse me if I seem dense on this, it's a new concept and it's hard for me to embrace it when I'm not seeing a real benefit.
Thanks,
--Jim