Posts

Showing posts from 2013

View State and Hidden Field

View State and Hidden Field The View State is client state mechanism in the ASP.Net statement management. The view state is control it will be used to maintain the state of the control across the posted back to the server. The view state of a page is, by default, placed in a hidden form field named __VIEWSTATE. Every time it needs to encryption and decryption (serialize and deserialize across the post backs).  The view state can be enabled by setting the property called EnableViewState="true/false".  It can be set in the machine config/ web config/ page directives/ control level. By default it is false. The view state also can store the data using the key and value combination. The data will be serialized and stored in the hidden control you can view the source code page and find the hidden control with _viewstate. Drawbacks : - Increase the page payload (when you have grid with many rows then everything has to be loaded and retain again with seriali

Difference Between For and Foreach loop

For        1.   If you want to access object by Index then use for loop.        2.   To use For loop you must have know that how many times loop repeated. Foreach         1.  if you want to iterate object then use foreach loop .        2.  in for each no need to know about total loop repeating. Performance  wise for loop is faster then foreach.