In ASP.net 2.0, many new functions and controls have been added, which have greatly improved in all respects compared to asp.net 1.0/1.1. Among them, in the data control aspect, has added many controls, in which the GridView control function is very formidable. In this article, a step-by-step example is given to the reader about the simple use of the GridView control in Asp.ne 2.0.
With ASP.net 1.0/1.1 's friends or feel, the DataGrid control function is very powerful and practical, but the attendant problem is that the feeling is still not easy to operate, For example, to use ado.net write data connection, binding DataGrid, Edit, delete, new data, etc. need a lot of code to achieve. In ASP.net 2.0, the DataGrid is still supported, but the new GridView control is more appealing, and the functionality is no less than the DataGrid, and it is easier to write code. Let's take a look at the GridView control with Visual Studio Express in the beta, and you can find it in the Data control page of the Toolbox, as shown in the following figure:
First, we create a new site with Visual Studio Express 1, and then drag the SqlDataSource control in the toolbar to the window. SqlDataSource is a data source control that makes it easy to configure a data source, establish a data connection, and almost no need to write code. We use the Northwind database in SQL SERVER 2000, so we can select the "Configure DataSource" on the right when we drag the control, as shown in the following figure:
After that, click the New button to create a data connection. In this article, we chose to localhost the local server, use Windows Integrated authentication, and choose to use the Northwind database, then click the Test Connection button to test the success of the connection, the success of the point "OK" completed, the following figure
Next, you will see a window showing details about the data connection in the following figure, click Next to Next