Asp Net Disable to Display the Webpage Again Postback

A claiming faced by web developers and designers is creating engaging, responsive, interactive web pages that load quickly and keep the user happy.  ASP.NET is a fantastic spider web application development platform but using information technology can mean operation problems caused by viewstate.

What is viewstate?

Viewstate is a technique used in ASP.Cyberspace to convey changes to the country of spider web forms beyond postbacks. A postback is the exchange of class data with the server. The viewstate of a page is, by default, stored in a hidden form field in the web page named __VIEWSTATE and this is where bug can arise.

viewstate

Why is information technology a problem?

The volume of data held in this hidden form field can become very large. This means increased page load times and, since all of the content of the hidden field must be exchanged during a postback, an increase in the time taken to complete an HTTP request.

Website developers who are corking to create slick, fast loading, low-bandwidth, convenient web pages can discover themselves struggling to minimize the amount of data stored and exchanged every bit viewstate. And since Google take now confirmed that page-load-time is one of the many ranking factors used to make up one's mind where a page should appear in the SERPs there is fifty-fifty more than incentive to make pages that are lean and fast. Perhaps more significantly, from an SEO perspective, the viewstate data generally precedes the important page content in the source society and can significantly inflate the page lawmaking.

What can be done?

Non being a programmer myself I asked an experienced ASP.Cyberspace developer (thanks Gavin) for his advice and recommendations for using viewstate and minimising the amount of viewstate data in a page. These were his pointers:

1) Mostly, a site blueprint should not rely upon viewstate. This needs to be decided at the outset as turning it off after a site has been developed tin lead to unexpected results (and the site not working).

2) Consider using other forms of state command, for example session state, application state, manually populated/restored hidden fields, cookies. The ASP.NET Cache can be used to store data / repopulate controls to forbid unnecessary round trips to the database.

3) If using server side controls try and restrict usage to unproblematic types; e.g. repeaters instead of data grids/views.

four) Viewstate can be eliminated from a page by not using server side forms or controls (runat="server" tag), withal the developer is so responsible for wiring up/coding class posts manually, the old fashioned way (Request.Class).

5) Viewstate can be turned off at the awarding, page and/or control level: (enableViewState="fake" tag). Even if you turn off viewstate for the entire awarding there volition still exist *some* viewstate on all pages (as viewstate is used to track which controls require postback). This is a merchandise off when using ASP.Internet Web Forms and the postback model.

6) In almost cases simply turning off viewstate in the command and ensuring you rebind any information on each post back will provide sufficient reduction in viewstate size. When doing this controls should be repopulated in the Init issue, not Load upshot. Data binding during the Load event risks overwriting values which have been restored from the Course during the Load issue.

seven) You can find out which pages are viewstate heavy using a tool such equally the ASP.Net View State Helper: http://www.binaryfortress.com/aspnet-viewstate-helper/

8) Big ViewState can be 'chunked' into a number of smaller fields using the maxPageStateFieldlength setting in the spider web.config file.

9) The ASP.Cyberspace MVC model does not use ViewState. Consider using the MVC model for the "front" (publicly accessible) areas of the site, and the Web Forms model for back terminate assistants areas where SEO is not an issue.

10) ASP.NET 4.0 Spider web Forms introduces the ViewStateMode property, which lets y'all disable viewstate by default and and then enable it just for controls that need it (opt-in versus previous opt-out model).

Hopefully these suggestions volition help developers who are struggling to shed a few kilobytes from their ASP.NET web pages.

LINKS:

Understanding ASP.Net View Land

TRULY understanding View Country

cherryparl1953.blogspot.com

Source: https://www.freshegg.co.uk/blog/web-design/responsive-design/creating-lean-fast-web-pages-view-state

0 Response to "Asp Net Disable to Display the Webpage Again Postback"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel