By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,213 Members | 1,193 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,213 IT Pros & Developers. It's quick & easy.

Sort DataGrid by Clicking Column Header

P: n/a
Within my tag: <asp:DataGrid
I'm using: AllowSorting="true" and
OnSortCommand="Sort_Grid" which referrs to a method in my
Codebehind file. (see Sort_Grid below)
Since I have AutoGenerateColumns="false"
within my tag: <asp:BoundColumn
I'm using: DataField="name" SortExpression="name"

This doesn't generate an error, but when I click on the
column heading I get:
System.Web.HttpException: The View State is invalid for
this page and might be corrupted.

I do not know how to fix this problem. I am not using
any ViewState in my code. Any guidance is appreciated,

public void Sort_Grid(Object sender,
DataGridSortCommandEventArgs e)
DataView dv = new DataView(dsAccounts.Tables["account"]);
dv.Sort = e.SortExpression;
//DataGrid = dgAccounts
dgAccounts.DataSource = dv;

Nov 15 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.