I use hidden textboxes myself.

…………………………………………………………………
Stephen Russell – 
Senior Visual Studio Developer, DBA

Memphis, TN
901.246-0159


> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of AstroDrabb
> Sent: Saturday, April 11, 2009 10:47 PM
> To: [email protected]
> Subject: [DotNetDevelopment] Re: Page Post Back
> 
> 
> On Fri, Apr 10, 2009 at 10:04 PM, ARUN KUMAR <[email protected]>
> wrote:
> > I alter your code :
> >
> > public partial class _default : System.Web.UI.Page
> >    {
> >
> >       Employee emp;
> >
> >        protected void Page_Load(object sender, EventArgs e)
> >        {
> >            if (!Page.IsPostBack)
> >            {
> >
> >                emp = new Employee ().GetEmployee();
> >                viewstate("Emp")=emp;  // Load to viewstate
> >            }
> >           else
> >                emp=viewstate("Emp");  // retrive from viewstate
> >        }
> >
> >        protected void btn_confirm_Click(object sender, EventArgs e)
> >        {
> >
> >                emp.FirstName = "something";
> >                emp.LastName = "something";
> >
> >          }
> >    }
> 
> ViewState ABUSE!!!
> 
> ViewState should be used for controls, not as an alternative to a
> session variable.
> 
> I have seen too many corp. apps that use ViewState as Session and you
> end up with
> pages that are 200K+.
> 
> ViewState gets sent with every request.  So sticking something in
> ViewState sends
> it to the client and then the client sends it back, for every darn
> request.
> 
> Use a Session if you want to save something that is not for a Control
> state.
> 
> With a Session you only send a session id.
> 
> I did this one contract for the govt. where they paid a boat-load of
> money for some
> consulting companies "framwork".  This "framework" put freaking
> everything in
> ViewState.  Page sizes were always 500K+.  I was brought on to
> "optimize" the
> app.  I basically had to go through the whole dang "framework" and just
> change
> everything from ViewState to Session.  Bang, ShamWow.  Much faster.
> WAY faster
> over the VPN, and much higher concurrent user numbers.
> 
> Don't abuse ViewState.  Don't use it if you didn't make a custom
> control.
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.287 / Virus Database: 270.11.53/2054 - Release Date:
> 04/11/09 10:51:00


Reply via email to