Avoiding server trips
A lot of the controls like radio buttons and checkboxes (and the cancel buttons) need not be web controls at all. They simply make the assembly heavier and slower.
Also, if they are html controls, there is less chance of people writing server-side code for them
When assigning attributes (like ‘onClick’) to web controls in the page load, it needs to be done only when (!IsPostBack)
For more up-to-date information, the following link seems to be a good reference, especially for IE. But please note that a lot of code that works on IE may not work on other browsers, so use this link only for IE based development.
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp
I completely agree with *** in that there really is no need to hit the server unless you need something from the DB.
Nearly all the work done on the forms right now - enabling / disabling, selection / de-selection of checkboxes and rows on grids, launching Pop-Ups etc - can be done on the client side. HTML controls are easier to use with JavaScript, especially in DataGrids.
I would also recommend Validator controls for all validations.
In addition to saving you from writing and maintaining JavaScript (the controls will do it) and providing uniformity in validation and error message display, the validation control also works on both ends.
Meaning that if a smart user bypasses the JavaScript validation (for example by disabling JavaScript on the browser), the control will still ensure that the input is validated on the server.
Also, if they are html controls, there is less chance of people writing server-side code for them
When assigning attributes (like ‘onClick’) to web controls in the page load, it needs to be done only when (!IsPostBack)
For more up-to-date information, the following link seems to be a good reference, especially for IE. But please note that a lot of code that works on IE may not work on other browsers, so use this link only for IE based development.
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp
I completely agree with *** in that there really is no need to hit the server unless you need something from the DB.
Nearly all the work done on the forms right now - enabling / disabling, selection / de-selection of checkboxes and rows on grids, launching Pop-Ups etc - can be done on the client side. HTML controls are easier to use with JavaScript, especially in DataGrids.
I would also recommend Validator controls for all validations.
In addition to saving you from writing and maintaining JavaScript (the controls will do it) and providing uniformity in validation and error message display, the validation control also works on both ends.
Meaning that if a smart user bypasses the JavaScript validation (for example by disabling JavaScript on the browser), the control will still ensure that the input is validated on the server.
Comments
Post a Comment