The GridView control is the workhorse of the ASP.NET 2.0 Framework. It is one of the most feature-rich and complicated of all the ASP.NET controls. The GridView control enables you to display, select, sort, page, and edit data items such as database records. The GridView renders its data items in an HTML table. Each data item is rendered in a distinct HTML table row.
For Example :
< %@ Page Language="VB" %>
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
< html xmlns="http://www.w3.org/1999/xhtml" >
< head id="Head1" runat="server">
< title>Show Students< /title>
< /head>
< body>
< form id="form1" runat="server">
< div>
< asp:GridView
id="grdStudent"
DataSourceID="srcStudent"
Runat="server" />
< asp:SqlDataSource
id="srcStudent"
ConnectionString="<%$ ConnectionStrings:Student %>"
SelectCommand="SELECT id,name,address,phone
FROM student"
Runat="server" />
< /div>
< /form>
< /body>
< /html>
the GridView control is bound to a SqlDataSource control, which represents the Student database table. The GridView is associated with its data source through its DataSourceID property
Custom Search
Wednesday, June 11, 2008
Displaying Data with GridView
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment