|
-
Oct 20th, 2007, 09:12 AM
#1
Thread Starter
Member
[RESOLVED] GridView's sort function
Hi, I'm trying to do this:
I am working on web app project. I'm using visual studio 2005, .net framework 2.0.
On Business Logic Layer (BLL), I stored the sql query result in UserCollection (UserCollection is a collection of User object which inherits the generic Collection class, User object is a class defined by me). Then passing this UserCollection to Presentation Layer.
On Presentation Layer, I bind this UserCollection to a GridView. I enabled Sorting on GridView. I defined the SortExpression for the column that I want to sort via GridView's SmartTag.
My question is, when I run the application, clicking on the GridView's column header, it will not sort the result. Why is it so? How can I make it able to sort?
Kindly advice in details. Thank you!!!
Last edited by thatzlim; Oct 29th, 2007 at 10:27 PM.
-
Oct 20th, 2007, 10:47 AM
#2
Hyperactive Member
Re: GridView's sort function
Could you post your grid view code, the aspx code. It might help solve your problem
-
Oct 20th, 2007, 12:04 PM
#3
Thread Starter
Member
Re: GridView's sort function
 Originally Posted by Rauland
Could you post your grid view code, the aspx code. It might help solve your problem
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim bllUser As New UserBLL
Dim colUser As UserCollection = bllUser.GetUser()
grdUser.DataSource = colUser
grdUser.DataBind()
End Sub
Code:
<asp:GridView ID="grdUser" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CssClass="cssGridView" GridLines="None">
<Columns>
<asp:BoundField DataField="UserID" HeaderText="UserID" Visible="False" />
<asp:BoundField DataField="UserName" HeaderText="UserName" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="DisplayName" HeaderText="DisplayName" SortExpression="DisplayName" />
</Columns>
</asp:GridView>
-
Oct 21st, 2007, 05:47 AM
#4
Thread Starter
Member
Re: GridView's sort function
i have found the solution...
HOW TO: Using sorting / paging on GridView w/o a DataSourceControl DataSource
http://forums.asp.net/t/956540.aspx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|