It keeps the new field values while editing or inserting the fields of a particular row. Defining Create Templated Grid View This is an important method which shows how to use the class only for post backs! Why is it done for all post backs and not just the first time?Actually, at each post back a dynamically templated Grid View cannot be presented from View State so we have to create and bind it explicitly using this method on all post backs.Do not call is complete, although I want to mention that there are some event handlers, "insert_button_Click" and "edit_button_Click" for Insert and Edit buttons respectively.They do nothing except the former sets the Session[Insert Flag] to 1 and the later sets it to 0.It is simple to do; create a button object, set its all properties accordingly, also add the button's click event handler and finally, add it into the control collection of the control (Container) passed as an argument.
It shows that we must know number of fields and their name in advance to create their templates. Listing 1 keeps an indicator in string form for a type of information within a template field i.e.
To make the Grid View simultaneously an operational one, we need to template it dynamically which also requires dynamically generated queries for corresponding operations according to the Grid View's data source.