473,289 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

Column sorting not working in GridView

I have a web page with a few textboxes used for filtering a read-only result
set to a GridView. I am unable to get the ObjectDataSource binding to work
as desired insofar as it returns a resultset on page load prior to the
filter requests for the query, so I am doing a dynamic binding to the
returned DataSet after a call to the business logic layer. It seems to work,
but I am unable to sort on the column headings even though I have set the
Sort Expression. Is it because of the late binding?

My code snippet is as follows:

protected void Search_Click(object sender, ImageClickEventArgs e)
{
string conn =
ConfigurationManager.ConnectionStrings["tst"].ConnectionString;
TSTBLL bll = new TSTBLL ();
TSTBE mt = bll.SubmitQuery(tbJobName.Text, tbOrderDateFrom.Text,
tbOrderDateTo.Text, conn);
GridView1.DataSource = mt.Test_Table;
GridView1.DataBind();
}
May 12 '06 #1
2 1472
K B
Oops...gave u the wrong link. This is the link with ALL the
information...

http://www.learnasp.com/freebook/lea...oDataSourceCon
trol.aspx
HTH,
Kit
*** Sent via Developersdex http://www.developersdex.com ***
May 14 '06 #2
This is close... however, my GridView.DataSource is returning as null in the
sorting event.

"K B" <ka**********@comcast.net> wrote in message
news:OO**************@TK2MSFTNGP05.phx.gbl...
Oops...gave u the wrong link. This is the link with ALL the
information...

http://www.learnasp.com/freebook/lea...oDataSourceCon
trol.aspx
HTH,
Kit
*** Sent via Developersdex http://www.developersdex.com ***

May 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I...
2
by: Daves | last post by:
I have a gridview displaying News items and fetches the data through a (little complicated) sql stored procedure... The sorting seems to be done in the gridview since there is no sorting...
1
by: James Rosewell | last post by:
I'm getting an error in the following scenario. - A GridView control is bound to an SQLDataSource. - The user selects a column for sorting. - Some time later in code the column used for sorting...
1
by: Eric | last post by:
I have a GridView control that I want to sort on multiple columns when I click a particular column. For example, I display Last name + ", " + First name in the first column and display id in the...
0
by: GMartin | last post by:
I have a pop-up form with a three columned Grid that has checkboxes in a Template Column in the first/left-most column. (The form is to allow users to select "Members" of a group, where they check...
3
by: =?Utf-8?B?YmJkb2J1ZGR5?= | last post by:
I have a question that maybe somebody can help me out. I have a gridview that is bound to a sqltable, and I have created two template columns. I am having problems getting the sorting to work....
3
by: Nathan Sokalski | last post by:
I have a GridView control with three columns, all BoundField columns. They all have a HeaderText and DataField property set, and the third one has a DataFormatString property as well. When I run my...
2
by: msrahul | last post by:
Hi EveryOne I have a gridview with sorting enabled. As we all know, when sorting is enabled in a gridview, the column names in the gridview get UNDERLINED permanently. I dont want this. i want the...
2
by: gnewsgroup | last post by:
I have a GridView, in which the header of one column changes depending on the selected value of a DropDownList outside of this GridView. I did this dynamic header through protected void...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.