SqlDataSource DataSourceMode DataSet
DataSourceModeDataSet.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>asp.net SqlDataSource example: DataSourceMode DataSet</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Teal">DataSourceMode DataSet Example</h2>
<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
DataSourceMode="DataSet"
SelectCommand="SELECT TOP 25 ProductID, ProductName, UnitPrice FROM Products"
>
</asp:SqlDataSource>
<asp:Label ID="Label1" runat="server" Text="Sorting and Paging are enable <br /> in DataSourceMode DataSet" Font-Bold="true" ForeColor="IndianRed">
</asp:Label>
<br /><br />
<asp:GridView
ID="GridView1"
runat="server"
DataSourceID="SqlDataSource1"
AllowPaging="true"
PageSize="5"
AllowSorting="true"
BackColor="Snow"
ForeColor="LightCoral"
HeaderStyle-BackColor="HotPink"
HeaderStyle-ForeColor="Snow"
BorderColor="HotPink"
>
</asp:GridView>
</div>
</form>
</body>
</html>
- asp.net GridView example: a sample simple Master-Details page
- asp.net SqlDataSource example: using FilterParameters, FilterExpression
- asp.net SqlDataSource example: SelectCommandType StoredProcedure
- asp.net QueryStringParameter example: how to use asp:QueryStringParameter
- asp.net SqlDataSource example: DataSourceMode DataReader
- asp.net DetailsView and ControlParameter example
- asp.net GridView HeaderStyle, AlternatingRowStyle example
- asp.net DetailsView HeaderTemplate, HeaderStyle, AlternatingRowStyle example
- asp.net DetailsView Fields, BoundField, PagerSettings, PagerStyle example
- asp.net GridView PagerSettings and PagerStyle example
- asp.net GridView Paging example: how to Paging GridView Data
- asp.net GridView Sorting example: how to sort GridView Data
- asp.net BoundField example: how to use asp:BoundFiled