Editing and deleting data with the GridView control is very simple. You simply
have to check the EnableEditing or the EnableDeleting checkboxes, as shown in the
following figure:
Displaying Views of Data (Part I)
[ 168 ]
Once you select these checkboxes, a corresponding link is displayed with the
respective captions that indicate the action to be performed. When you click on the
Edit button, the fields become editable. Moreover, you have the Update and Cancel
links displayed in place of the Edit link in the GridView control, as displayed in the
following screenshot:
Refer to the previous screenshot. Now you can make your changes and click on the
Update button to update the data or Cancel to cancel the changes made. Similarly,
you can enable the EnableDeleting property so that you can make the GridView
support deletion of data. Note that you can enable both the EnableEditing and
EnableDeleting properties so as to make the GridView both editable and also make
it support deletion of data. The best part here is that you can do all this without
writing even a single line of code! The following screenshot illustrates the GridView
control in design view with both Editing and Deleting enabled.
Chapter 6
[ 169 ]
Exporting the GridView Data
In this section we will explore how we can export the data displayed in a GridView
control to MS Excel and MS Word.
Pages:
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171