Using the GridView control in asp.net 2.0

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.