Updating all gridview contents at a time to the database
For this article I'm going to demonstrate connecting to, retrieving, and displaying data from the Microsoft Access Northwind database, which is included in the download.(Note that I'm using a slightly modified, slimmed down version of Northwind, one whose Forms, Modules, Reports, and Macros have all been deleted to reduce the file size.) ASP. When using professional grade database systems, like Microsoft SQL Server, typically the database is registered on a separate database server. Next, drag a Sql Data Source control from the Toolbox onto the Designer.While you can set all of these properties by hand in the Source view, the Design view offers a time-saving wizard for quickly specifying which database to connect to and what query to issue.To get started, fire up Visual Studio 2005 and create a new website or, alternatively, download the code example at the end of this article.When you click the Edit button, the data grid automatically enters edit mode.
Take a look at the page load if you are binding on post back then the values get updated before you are able to access them.Smart Tag and choose "Edit Columns." Verify that the checkboxes to enable editing and deleting are selected, as shown in Figure 4-17.If you prefer to have buttons for Edit and Delete, rather than links, click on the Smart Tag and select "Edit Columns…" When the Fields dialog box opens, click the Command Field entry in the Selected Fields area (lower-left corner).With the declarative, "code free" Data Source controls you can create a page that displays database data in under 15 seconds and without having to write a line of code. Both controls have virtually the same featureset, the only difference being how you specify the connection information.In fact, the Access Data Source control is really superfluous since Microsoft Access databases can be accessed through the Sql Data Source control just as easily.
In addition, you want all the Product Numbers that begin with the letters CA to display in green.