I am a new ASP.NET developer and now I am having an issue in the system that I am working on it. I have a GridView and I already enabled the paging functionality on it. What I want now is showing 12 or 14 elements in the GridView and then use paging to show the other next 12 elements, so how to do that?
My ASP.NET code:
<!-- Content Goes Here! -->
<asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource6" CssClass="datatable"
CellPadding="0" BorderWidth="0px" GridLines="None"
OnDataBinding="GridView3_DataBinding" AllowPaging="True">
<Columns>
<asp:BoundField DataField="Title" HeaderText="Quiz"
SortExpression="Title" />
<asp:BoundField DataField="DivisionShortcut"
HeaderText="Division"
SortExpression="DivisionShortcut" />
<asp:BoundField DataField="Total Number of Participants"
HeaderText="Total Number of Participants" ReadOnly="True"
SortExpression="Total Number of Participants"/>
</Columns>
<RowStyle CssClass="row" />
<SortedAscendingCellStyle CssClass="sortasc"></SortedAscendingCellStyle>
<SortedAscendingHeaderStyle CssClass="sortasc"></SortedAscendingHeaderStyle>
<SortedDescendingHeaderStyle CssClass="sortdesc"></SortedDescendingHeaderStyle>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource6" runat="server"
ConnectionString="<%$ ConnectionStrings:testConnectionString %>" SelectCommand="SELECT dbo.Quiz.Title, dbo.Divisions.DivisionShortcut, COUNT(DISTINCT dbo.UserQuiz.Username) AS [Total Number of Participants]
FROM dbo.employee INNER JOIN
dbo.UserQuiz ON dbo.employee.Username = dbo.UserQuiz.Username INNER JOIN
dbo.Quiz ON dbo.UserQuiz.QuizID = dbo.Quiz.QuizID INNER JOIN
dbo.Divisions ON dbo.employee.DivisionCode = dbo.Divisions.SapCode
GROUP BY dbo.Quiz.Title, dbo.Divisions.DivisionShortcut
ORDER BY dbo.Quiz.Title"></asp:SqlDataSource>
So how to do that?
1 Answer