Reputation: 7289
I have heard that html components are light weight than asp.net components, so will the performance of the web application increase by avoiding the usage of asp.net components like asp:button and use only html components ??
Also will the usage of asp.net components increase server load?? when an event occurs (say asp.net button click) will the entire view state be sent across to the server and received back? so this will be causing lot of data to be transmitted to and fro right?
These will not happen if i use html buttons and ajax calls to send/receive data instead of asp.net elements and thus performance will be optimized. is my understanding correct? please provide your view
Upvotes: 1
Views: 395
Reputation: 8077
If you use html elements instead of asp.net elements it is true that the size of the ViewState will re reduced but I am not sure that this will optimize your web application, since you will have to write extra code to handle input from the HTML elements. You will have to write more complicated code and this code will add some overhead on your application's performance.
In every event (e.g. Button_Click
) the entire ViewState is sent to the web server. Having a large ViewState will make your application slow and heavy.
Using ajax calls is a good approach since this way you make small requests that do one action and because of that they are usually lightweight. Also, using ajax calls also gives a richer user experience.
My opinion in general is:
Output
directive, or you can use the ASP.NET cache mechanism (HttpContext.Current.Cache
) and put objects there. This way, you can reduce the number of calls in the database.I would also recommend to learn how ViewState works so that you can find ways to reduce its size.
I just found this link in which ASP.NET performance is discussed in general, you might find it useful.
Upvotes: 2