When page is to be posted back to the server, browser collects the current values of each control and pastes it together into a string. This postback data is then sent back to the server via HTTP POST.
Q1 – Besides control’s Text attributes and SelectedIndexchanged ( thus besides user input data), are there other attributes/values of a control which are saved by a browser as postback data?
Q2 – In case of GridView, which values are saved by a browser on a postback? Only those in a row which the user chooses to edit?
byte
The values of
textarea,select,inputandbuttonfields are returned in the post. Each value is a key-value pair where the key is thenameproperty of the element.I think that I have got all the elements that include data in the post:
textarea: Thevaluepropery is included, i.e. what’s typed in the textarea.select: Thevalueproperty of the selected option is included. If the selected option doesn’t have avalueproperty specified, the text of the option is used.input type='text': Thevalueproperty is included, i.e. what’s typed in the input field.input type='password': Thevalueproperty is included, i.e. what’s typed in the input field.input type='submit': If the button was used to send the form, thevalueproperty is included, i.e. the text of the button.input type='image': If the button was used to send the form, the coordinates of the mouse click within the image is sent in the post. Names for the x and y coordinates are created by adding ‘.x’ and ‘.y’ to the name of the element.input type='checkbox': If the checkbox is checked, thevalueproperty is included. If the element has novalueproperty specified, the value ‘on’ is used.input type='radio': Thevalueproperty is included from the selected item from each group. (A group is all radio buttons with the same name.)input type='file': The content of the selected file is included, along with the original file path (or only the file name, depending on browser and security settings).input type='hidden': Thevalueproperty is included.button: If the button was used to send the form, theinnerTextproperty is included, i.e. the text of the button with any html markup removed.A
TextBoxcontrol is rendered either as aninput type='text', aninput type='password'or atextarea, depending on theTextModeproperty. ADropDownListcontrol is rendered as aselectelement. AButtoncontrol is rendered as aninput type='submit'. ACheckBoxcontrol is rendered as aninput type='checkbox'. And so on… check the rendered html code to see what the actual html elements rendered are.A GridView only includes any data in the post if it contains any editable form fields, or if it causes a postback (by navigating in the list for example). When doing a postback there is some information stored in a pair of hidden fields, so any control that causes a postback but doesn’t send any form data by itself (like a LinkButton for example) does include information about what caused the postback.
Controls may also put data in the ViewState, which is kept in a hidden field in the form. This is also included in the post, but it’s just sent to the browser and back again without being changed by the browser.