inicio mail me! sindicaci;ón

How does ASP.NET undertake function optimizes a problem (2)

3, of the page optimize (.aspx)

Basically be aimed at attribute of a few pages

1, the view status) of EnableViewState(page. If do not have special requirement,the setting is False. Use ViewState, every object must first alignment changes ViewState in, next repass is answered pass undertake alignment is changed turning over, because this uses ViewState,do not have cost. Reduce use target as far as possible, if likelihood, reduce the number of the target that is put into ViewState as far as possible. The circumstance basically can ban below with Viewstate:

(1) the page accuses (.ascx)

(2) the page is not answered pass oneself.

(3) need not be opposite accuse incident processing.

(4) accuse do not have trends or data binds decided attribute to be worth (or handle in code to every Postpack)

Single page or every page is banned with ViewState, following place show: Single page: <%@ Page EnableViewState="False" %> every page: In Web.config <Pages EnableViewState="false" /> EnableSessionState holds acquiescent cost can (if the page is used to Sessionstate,it just can take up resource) . If EnableViewStateMac does not have the special requirement on safety, hold acquiescent cost.

2, Pagelayout. Page layout model. Element of proposal use Flowlayout(does not take attribute of absolutely fixed position to add) attribute of.Gridlayout(absolutely fixed position) because use absolutely fixed position, will produce more code than Flowlayout, basically be to accuse fixed position information.

3, when the project is released, be sure to keep in mind to remove the Debug condition of the page.

4, of Html language optimize. My proposal is adroitness control Html/javascript, use the code that Vs.net2003 produces automatically less, it can generate the Html code of a few no use automatically.

5, the sentience that Smart Navigation setting can let the user is apparent for True can rise. After enabling this attribute, be carried to the client and serve end to affect not quite. It can rinse of intelligent rinse new need wants the share with new rinse newly.

4, accuse choice:

Html accuses accuse with the server choice. Html accuses a place to cannot be likened to the server accuses the implementation on a brought convenience and function. But be the resource that carries with sacrificial server will obtain. My individual suggests: If Html accuses a short of place to want the function of implementation, and with language of a few script (be like Javascrpt/vbscript) if union also cannot come true. Just can choose a server to accuse. Choice server accuses hind, also accuse to its as far as possible optimize, if cancel condition of a few pages to wait (specific look accuse optimize)

The server accuses choice: Basically accuse a specification in the light of a few commonly used data:

DataGrid: Show from the data with the most powerful belt accuse, inside buy logarithm occupies revise, delete, add, divide a lot of fact such as the page to use a function. If you need to show to data only, do not choose DataGrid as far as possible (it stores data in Viewstate) . Also do not use the function distributing a page that takes oneself, microsoft did a lot of works in the ground floor that distributes a page automatically, although use,went to the lavatory, but performance expense is big.

DataList: a lot of less than DataGrid function. But define a gender oneself a lot of stronger. Peculiar much travel data shows, brought a lot of to us. The function that DataGrid can realize, it can come true basically. So the proposal uses it.

Repeater: The function is least, but define a gender oneself very strong. If need to show to data only, suggest to use. Because reduced a lot of functions, bring to the function of the server use up the smallest. Accordingly, if be the word that shows to data, I basically am choice Repeater next DataList final DataGrid

* chooses Html to accuse as far as possible. The function that can carry implementation in the client carries implementation in the client (adroitness control Javascript) , reduce the pressure of the server. Data charges a choice order: Repeater, DataList, DataGrid

5, the server accuses optimize:

1, Viewstate

Accuse the Viewstate of Viewstate and page is basic it is consistent. With will save accuse a few condition. Like handling principle and the Viewstate that handle a page. The can bind destiny to be saved according to checking next Viewstate with Datagrid data bulk that have fun at has how old, the data bulk volume that the data that it saves shows basically with Datagrid is equal.

2, Ispostpack

Acquiescent False. When need arises event, ability needs a setting to be True.

Accuse optimize, basically see you accuse to this be in the push. The principle that runs to accusing an interior jumps over understanding, can make to its optimize suitably.

Function is optimized is 29 words say not clear, what what I draw up is an iceberg merely one horn, of function optimizing is to lean at ordinary times of experience accumulate and the runs a principle ceaseless acknowledge to the program.

Bookmark:Digg Del.icio.us Reddit

Leave a Comment