473,397 Members | 1,969 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,397 software developers and data experts.

Sort web Datagrid

I am trying to sort a web datagrid asp.net.
In the sort command I use:

private void MyGrid_SortCommand(object source,
System.Web.UI.WebControls.DataGridSortCommandEvent Args e)
{
DataView SortView = anteSet11.Ante.DefaultView;
SortView.Sort = e.SortExpression;
MyGrid.DataSource = SortView;
MyGrid.DataBind();
}

In the page_load I use:

private void Page_Load(object sender, System.EventArgs e)
{
sqlDataAdapter1.Fill(anteSet11);
if (!IsPostBack)
{
MyGrid.DataSource = anteSet11.Ante.DefaultView;
}
MyGrid.DataBind();
}

When I press the header, the computer clicks (makes a
sound) but the column does not sort.
I have allowed sorting on the grid's property page.
Generate-columns-automatically is off. The sort command
for each column is appropriate.
The datagrid works in other tasks such as paging, update,
edit and delete.
Any suggestions would be welcomed.
Thanks,
Jim
Nov 18 '05 #1
11 2136
Hi

Check the following article
http://www.aspng.com/freebook/learn/gridevents.aspx

HTH
Ravikanth[MVP]
-----Original Message-----
I am trying to sort a web datagrid asp.net.
In the sort command I use:

private void MyGrid_SortCommand(object source,
System.Web.UI.WebControls.DataGridSortCommandEven tArgs e)
{
DataView SortView = anteSet11.Ante.DefaultView;
SortView.Sort = e.SortExpression;
MyGrid.DataSource = SortView;
MyGrid.DataBind();
}

In the page_load I use:

private void Page_Load(object sender, System.EventArgs e)
{
sqlDataAdapter1.Fill(anteSet11);
if (!IsPostBack)
{
MyGrid.DataSource = anteSet11.Ante.DefaultView;
}
MyGrid.DataBind();
}

When I press the header, the computer clicks (makes a
sound) but the column does not sort.
I have allowed sorting on the grid's property page.
Generate-columns-automatically is off. The sort command
for each column is appropriate.
The datagrid works in other tasks such as paging, update,edit and delete.
Any suggestions would be welcomed.
Thanks,
Jim
.

Nov 18 '05 #2
Did you notice that my code was in C#, the example sited
is in vb.net. Any suggestions in C# would be appreciated.
Thanks,
Jim
-----Original Message-----
Hi

Check the following article
http://www.aspng.com/freebook/learn/gridevents.aspx

HTH
Ravikanth[MVP]
-----Original Message-----
I am trying to sort a web datagrid asp.net.
In the sort command I use:

private void MyGrid_SortCommand(object source,
System.Web.UI.WebControls.DataGridSortCommandEve ntArgs e){
DataView SortView = anteSet11.Ante.DefaultView;
SortView.Sort = e.SortExpression;
MyGrid.DataSource = SortView;
MyGrid.DataBind();
}

In the page_load I use:

private void Page_Load(object sender, System.EventArgs e){
sqlDataAdapter1.Fill(anteSet11);
if (!IsPostBack)
{
MyGrid.DataSource = anteSet11.Ante.DefaultView;
}
MyGrid.DataBind();
}

When I press the header, the computer clicks (makes a
sound) but the column does not sort.
I have allowed sorting on the grid's property page.
Generate-columns-automatically is off. The sort commandfor each column is appropriate.
The datagrid works in other tasks such as paging,

update,
edit and delete.
Any suggestions would be welcomed.
Thanks,
Jim
.

.

Nov 18 '05 #3
Hi Jim,

Based on my research and experience, the following articles are useful to
you. Please refer to them carefully.

Effective Sorting in ASP .NET DataGrids
http://msdn.microsoft.com/msdnnews/2...ng/Sorting.asp

Adding Sorting to a DataGrid Control
http://authors.aspalliance.com/aspxt...ingsortingtoda
tagrid.aspx

I hope it helps.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #4
I have reviewed and used the two articles you have
suggested along with Duthie's book "ASP.net with visual
C#"
Still, when I click a column header, the computer
responds with a clicking noise, the page is reloaded on
the browser, but the column remains unsorted.
The SQL database I am using was upsized from Access2000.
Does this have an effect on the lack of sorting behavior ?
The other possible problem may be in my page_load event
handler.
The code I use is
private void Page_Load(object sender, System.EventArgs e)
{
sqlDataAdapter1.Fill(anteSet11);
if (!IsPostBack)
{
MyGrid.DataSource = anteSet11.Ante.DefaultView;
MyGrid.DataBind();
}
}

Any suggestions to my problem along with sample code
would be appreciated.
Thanks in advance for your help,
Jim
-----Original Message-----
Hi Jim,

Based on my research and experience, the following articles are useful to you. Please refer to them carefully.

Effective Sorting in ASP .NET DataGrids
http://msdn.microsoft.com/msdnnews/2...t/Sorting/Sort ing.asp
Adding Sorting to a DataGrid Control
http://authors.aspalliance.com/aspxt...bforms/control s/addingsortingtodatagrid.aspx

I hope it helps.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
.

Nov 18 '05 #5
Jim... This may help.

http://www.geocities.com/jeff_louie/net_sort.htm
Sorting a View

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #6
Hi Jim,

Have you checked Jeff's response to this issue? Does it answer your
question?

If you need further assistance, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #7
Hi Jim,

Have you checked Jeff's response to this issue? Does it answer your
question?

If you need further assistance, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #8
Dear Jacob:
I am starting to feel a little dense here.
In your latest reply you mention Jeff's response.
Where is Jeff's response ? It doesn't seem to be in this
thread.
As I mentioned previously, the SQL database I formed by
upsizing a Microsoft Access2000 database will not sort.
When I substitute the sample PUBS database the grid will
sort. Is there a way to allow my database to sort on a
web datagrid ?
Thanks,
Jim
-----Original Message-----
Hi Jim,

Have you checked Jeff's response to this issue? Does it answer your question?

If you need further assistance, please feel free to let me know.
Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
.

Nov 18 '05 #9
Dear Jacob:
I am starting to feel a little dense here.
In your latest reply you mention Jeff's response.
Where is Jeff's response ? It doesn't seem to be in this
thread.
As I mentioned previously, the SQL database I formed by
upsizing a Microsoft Access2000 database will not sort.
When I substitute the sample PUBS database the grid will
sort. Is there a way to allow my database to sort on a
web datagrid ?
Thanks,
Jim
-----Original Message-----
Hi Jim,

Have you checked Jeff's response to this issue? Does it answer your question?

If you need further assistance, please feel free to let me know.
Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
.

Nov 18 '05 #10
Hi James,

It seems that there is some problem in the internet. The followiing is
Jeff's response to this issue.

========================
From: Jeff Louie <je********@yahoo.com>
Subject: Re: Sort web datagrid
Newsgroups: microsoft.public.dotnet.framework.aspnet
Date: Mon, 01 Dec 2003 19:50:50 -0800

Jim... This may help.

http://www.geocities.com/jeff_louie/net_sort.htm
Sorting a View

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
============================

You have not replied this thread for two business days so I want to know if
the problem is resolved. Thank you for your understanding.

In addition, based on my research and experience, a SQL database upsized
from Access2000 should not cause such a problem.

I hope it helps.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #11
Hi James,

It seems that there is some problem in the internet. The followiing is
Jeff's response to this issue.

========================
From: Jeff Louie <je********@yahoo.com>
Subject: Re: Sort web datagrid
Newsgroups: microsoft.public.dotnet.framework.aspnet
Date: Mon, 01 Dec 2003 19:50:50 -0800

Jim... This may help.

http://www.geocities.com/jeff_louie/net_sort.htm
Sorting a View

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
============================

You have not replied this thread for two business days so I want to know if
the problem is resolved. Thank you for your understanding.

In addition, based on my research and experience, a SQL database upsized
from Access2000 should not cause such a problem.

I hope it helps.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #12

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

Similar topics

3
by: | last post by:
Is there an event that is invoked when a user sorts a column in a Windows Forms DataGrid? I have context senstive icons that are enabled\disabled depending upon the selected item in the...
5
by: Bill Todd | last post by:
In a WinForms application with a DataGrid bound to a DataTable, if I change the DefaultDataView.Sort property the order of the data in the grid does not change. If I change the Sort property...
4
by: Steve B. | last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's reflect the contents of the grid cells. Sorting of columns (both thru VS and programmatically) work fine except, when the...
7
by: DC Gringo | last post by:
I have a datagrid that won't sort. The event handler is firing and return label text, just not the sort. Here's my Sub Page_Load and Sub DataGrid1_SortCommand: -------------------- Private...
5
by: Kurt Schroeder | last post by:
I'm using VS.net. I have created a component with the basic set of database commands. This component returns a record set that is bound to a datagrid. I want to add a dynamic sort, but am not sure...
4
by: Joe | last post by:
Hello, I have a datagrid in an nested html table (one table inside of another table) and have set the allowsSorting property to true. I've created in the code-behind a method (Sub - I'm using...
1
by: troyblakely | last post by:
I am having trouble sorting a datagrid. I have read numerous posts on this and other lists, and tried most of the suggestions, but none of them have worked for me yet. I populate a dataset from two...
1
by: Jean-Claude Bertrand | last post by:
Hi! Windows of the application IO have to built (my first one in vb.Net) is made from 2 part: a) A grid wich will be used only to display the main information of the current record (so the...
2
by: shuckjunkmail | last post by:
It was suggested that I re-submit this question as a new post rather than adding onto an old and unanswered post. The basic problem has to do with the .NET datagrid and sorting. I am having...
4
by: G .Net | last post by:
Hi I have a question which I hope you can help with. I am setting the DataSource of a DataGrid to be a DataView. I am sorting the DataView by various fields which include a Date. When I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.