Sort Grid from Column Header and Drop Down???
I posted a message on the topic earlier and thought I had it solved
but in testing have found problems. I have a Templated GridView
control on a webpage bound to an ObjectDataSource. There are 3
columns that are "Sortable" That sorting works fine until I add the
dropdown with a "refresh" button into the mix. The only way that I
have found to sort the grid from the dropdown requires the following
When I set the e.Arguments.SortExpression it causes the grid to get
sorted the problem is the Grid properties do not reflect this change.
So when you next click on the grid column to sort it has the wrong
information as to which column is sorted and what direction is
sorted. So the first click on the column header the results are
unpredicable. Is there a better way to do this?
Any help would be greatly appreciated.
protected void btnRefresh_Click(object sender, EventArgs e)
Convert.ToInt16(cboSortBy.SelectedValue.Substring( 0, 1));
sortDirection = "ASC";
else if (cboSortBy.SelectedValue.EndsWith("D"))
sortDirection = "DESC";
throw new Exception("Invalid sort by Value");
protected void ObjectDataSource1_Selecting(object sender,
if (sortExpression != "")
e.Arguments.SortExpression = sortExpression + " "
Re: Sort Grid from Column Header and Drop Down???
> So when you next click on the grid column to sort it has the wrong
> information as to which column is sorted and what direction is
Store sorting information in the ViewState.
Maybe you will find it usefull.
|All times are GMT. The time now is 08:32 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.