Congratulations - C# Corner Q4, 2022 MVPs Announced
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Hold On
1.2k
1.1k
211.1k
Effective Paging in a Gridview From a Stored Procedure
May 8 2021 12:42 PM
Hello everyone,
I found this article "https://www.codeproject.com/Articles/125541/Effective-Paging-with-GridView-Control-in-ASP-NET" which explains how to implement an effective sorting. Unfortunately, the author is using an ObjectDataSource to display the data to the grid view while I am displaying the data from the code behind. Can someone help me to implement his idea from the code behind? Below is the gridview and ObjectDataSource mark-up
<
div
>
<
asp:GridView
ID
=
"gvProfile"
DataSourceID
=
"profileDataSource"
runat
=
"server"
AutoGenerateColumns
=
"false"
AllowPaging
=
"true"
AllowSorting
=
"true"
PageSize
=
"5"
HeaderStyle-Font-Names
=
"Verdana"
Font-Size
=
"Small"
HeaderStyle-HorizontalAlign
=
"Left"
HeaderStyle-Font-Underline
=
"false"
Width
=
"55%"
HeaderStyle-BackColor
=
"BurlyWood"
HeaderStyle-ForeColor
=
"Navy"
>
<
AlternatingRowStyle
BackColor
=
"Aquamarine"
/>
<
Columns
>
<
asp:BoundField
DataField
=
"ProfileId"
HeaderText
=
"Profile Id"
SortExpression
=
"ProfileId"
ItemStyle-Width
=
"6%"
/>
<
asp:BoundField
DataField
=
"Name"
HeaderText
=
"Name"
SortExpression
=
"Name"
ItemStyle-Width
=
"13%"
/>
<
asp:BoundField
DataField
=
"Address"
HeaderText
=
"Address"
SortExpression
=
"Address"
ItemStyle-Width
=
"18%"
/>
<
asp:BoundField
DataField
=
"Email"
HeaderText
=
"Email"
SortExpression
=
"Email"
ItemStyle-Width
=
"8%"
/>
<
asp:BoundField
DataField
=
"Mobile"
HeaderText
=
"Mobile"
SortExpression
=
"Mobile"
ItemStyle-Width
=
"9%"
/>
<
asp:BoundField
DataField
=
"IsActive"
HeaderText
=
"Status"
SortExpression
=
"IsActive"
ItemStyle-Width
=
"4%"
/>
</
Columns
>
</
asp:GridView
>
</
div
>
</
center
>
<
asp:ObjectDataSource
ID
=
"profileDataSource"
runat
=
"server"
SelectMethod
=
"GetProfileData"
EnablePaging
=
"true"
MaximumRowsParameterName
=
"pageSize"
StartRowIndexParameterName
=
"startRowIndex"
TypeName
=
"VTS.Web.UI.ProfileDataSource"
SelectCountMethod
=
"TotalRowCount"
SortParameterName
=
"sortExpression"
>
<
SelectParameters
>
<
asp:Parameter
Name
=
"startRowIndex"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"pageSize"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"sortExpression"
Type
=
"String"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
Thank you in advance.
Reply
Answers (
2
)
asp.net core if condition is not working properly
i want add model data with mulitple image