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.

This is where the concept of dynamically templated Grid View comes.

This is a Grid View that can be bound to any table of any database of any server, providing Insert, Edit and Delete option simultaneously.

Although just binding the Grid View with some dynamically changing datatsource is a simple and straight job which does not need templated Grid View, it cannot facilitate us with the aforementioned operations.

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.

Its implementation in the current scenario is a little lengthy, yet it is quite easy as we have to do a similar type of job with each control; instantiate it, set its text property with is a Button then it creates three buttons for the aforementioned tasks.

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.

If the these text boxes are emptied, they can be used for insertion instead of editing without dedicating an extra row for it.

This is easy and handy as it becomes a better approach when it is not known in advance how many columns there are in Grid View's data source.

NETLearn AJAXLearn Silverlight Learn Visual Studio Learn ADO. NETLearn Web Services Learn Controls Learn Biz Talk Learn Share Point Learn Mobile Learn SQLLearn SQL Reporting Learn Windows Forms Learn XMLLearn Crystal Reports Learn Far Point Learn Dev Express Examples ASP.