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

Q: DataGrid Sort

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 create a new row in the DataGrid and set the date to me within the
current sort range, the newly created row "jumps" to its correct position in
the grid. This obviously makes sense because it is following the sort rule.

However, I would like to be able to achive the following:

(1) Display the DataView in the DataGrid initially sorted using the rules
specified.
(2) New rows can be added to the DataGrid BUT no sorting will occur.
(3) If a button is pressed, then the grid will re-sort using the sort rule
specified initially.

I don't know if it makes any difference but the DataView I am using is
global to the form.

I hope somebody can help.

Many thanks in advance

G
Apr 2 '06 #1
4 1526
Hi,

Be aware that this acts probably different in versions 2002/2003 and 2005

The dataview should be dynamic but is that not always in 2002/2003

As well is there a bug that put a newly added datarow at the end in some
situations of the datagrid. Exactly in fact as you want.

But making use of that bug is not the best thing to do.

I hope that you understand because of this that your question is difficult
answer

Cor

"G .Net" <no********@email.com> schreef in bericht
news:ue********************@pipex.net...
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 create a new row in the DataGrid and set the date to me within the
current sort range, the newly created row "jumps" to its correct position
in the grid. This obviously makes sense because it is following the sort
rule.

However, I would like to be able to achive the following:

(1) Display the DataView in the DataGrid initially sorted using the rules
specified.
(2) New rows can be added to the DataGrid BUT no sorting will occur.
(3) If a button is pressed, then the grid will re-sort using the sort rule
specified initially.

I don't know if it makes any difference but the DataView I am using is
global to the form.

I hope somebody can help.

Many thanks in advance

G

Apr 2 '06 #2
Hi Cor

I'm using VS 2003.

I think I understand what you mean, however, just to clarify, are you saying
what I want to do is impossible?

G

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:en**************@TK2MSFTNGP12.phx.gbl...
Hi,

Be aware that this acts probably different in versions 2002/2003 and 2005

The dataview should be dynamic but is that not always in 2002/2003

As well is there a bug that put a newly added datarow at the end in some
situations of the datagrid. Exactly in fact as you want.

But making use of that bug is not the best thing to do.

I hope that you understand because of this that your question is difficult
answer

Cor

"G .Net" <no********@email.com> schreef in bericht
news:ue********************@pipex.net...
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 create a new row in the DataGrid and set the date to me within the
current sort range, the newly created row "jumps" to its correct position
in the grid. This obviously makes sense because it is following the sort
rule.

However, I would like to be able to achive the following:

(1) Display the DataView in the DataGrid initially sorted using the rules
specified.
(2) New rows can be added to the DataGrid BUT no sorting will occur.
(3) If a button is pressed, then the grid will re-sort using the sort
rule specified initially.

I don't know if it makes any difference but the DataView I am using is
global to the form.

I hope somebody can help.

Many thanks in advance

G


Apr 2 '06 #3
G,

You can forever add an extra column and set in that a default value.

When you add it you set this column to a vale which is higer than the
default value.
You take that your dataview as first sort key.
If the button is pressed than you can change that column in the last datarow
in the datatable again to the default value..

The last row is datatable.rows(datatable.rowcount-1)

Not that difficult in my opinion and as far as I can see now will that work
forever.

I hope this helps,

Cor

"G .Net" <no********@email.com> schreef in bericht
news:op********************@pipex.net...
Hi Cor

I'm using VS 2003.

I think I understand what you mean, however, just to clarify, are you
saying what I want to do is impossible?

G

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:en**************@TK2MSFTNGP12.phx.gbl...
Hi,

Be aware that this acts probably different in versions 2002/2003 and 2005

The dataview should be dynamic but is that not always in 2002/2003

As well is there a bug that put a newly added datarow at the end in some
situations of the datagrid. Exactly in fact as you want.

But making use of that bug is not the best thing to do.

I hope that you understand because of this that your question is
difficult answer

Cor

"G .Net" <no********@email.com> schreef in bericht
news:ue********************@pipex.net...
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 create a new row in the DataGrid and set the date to me within
the current sort range, the newly created row "jumps" to its correct
position in the grid. This obviously makes sense because it is following
the sort rule.

However, I would like to be able to achive the following:

(1) Display the DataView in the DataGrid initially sorted using the
rules specified.
(2) New rows can be added to the DataGrid BUT no sorting will occur.
(3) If a button is pressed, then the grid will re-sort using the sort
rule specified initially.

I don't know if it makes any difference but the DataView I am using is
global to the form.

I hope somebody can help.

Many thanks in advance

G



Apr 2 '06 #4
Thanks Cor

G

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...
G,

You can forever add an extra column and set in that a default value.

When you add it you set this column to a vale which is higer than the
default value.
You take that your dataview as first sort key.
If the button is pressed than you can change that column in the last
datarow in the datatable again to the default value..

The last row is datatable.rows(datatable.rowcount-1)

Not that difficult in my opinion and as far as I can see now will that
work forever.

I hope this helps,

Cor

"G .Net" <no********@email.com> schreef in bericht
news:op********************@pipex.net...
Hi Cor

I'm using VS 2003.

I think I understand what you mean, however, just to clarify, are you
saying what I want to do is impossible?

G

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:en**************@TK2MSFTNGP12.phx.gbl...
Hi,

Be aware that this acts probably different in versions 2002/2003 and
2005

The dataview should be dynamic but is that not always in 2002/2003

As well is there a bug that put a newly added datarow at the end in some
situations of the datagrid. Exactly in fact as you want.

But making use of that bug is not the best thing to do.

I hope that you understand because of this that your question is
difficult answer

Cor

"G .Net" <no********@email.com> schreef in bericht
news:ue********************@pipex.net...
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 create a new row in the DataGrid and set the date to me within
the current sort range, the newly created row "jumps" to its correct
position in the grid. This obviously makes sense because it is
following the sort rule.

However, I would like to be able to achive the following:

(1) Display the DataView in the DataGrid initially sorted using the
rules specified.
(2) New rows can be added to the DataGrid BUT no sorting will occur.
(3) If a button is pressed, then the grid will re-sort using the sort
rule specified initially.

I don't know if it makes any difference but the DataView I am using is
global to the form.

I hope somebody can help.

Many thanks in advance

G



Apr 3 '06 #5

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

Similar topics

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...
0
by: Robert Brinson | last post by:
Hello all! I'm running .NET Framework 1.1 using VS.NET 2003. I've got a mystery with a DataGrid. Below is the definition of the DataGrid from my aspx page: </asp:datagrid><asp:datagrid...
2
by: enak | last post by:
I can not get my datagrid to page. I have a datagrid that I can sort 2 of the columns. This works great. I added paging and when I display the dg it shows 5 pages. (I am showing page numbers at...
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...
1
by: Jeremy | last post by:
I want my gird to sort only the items on the current page when I click on a column header. I wrote a little test app, but when I sort it pulls in items from other pages and places them on the current...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
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...
2
by: Joey | last post by:
I have an asp.net 1.1 C# web application with a datagrid. I set the datagrid's "AllowSorting" property to "True". Then I created a sort function for it by selecting the datagrid in the designer,...
0
by: rn5a | last post by:
A DataGrid control displays records from a SQL Server 2005 DB table. The AllowSorting property of the DataGrid has been set to True & the SortExpressions of the BoundColumns have been set to the...
0
by: rupalirane07 | last post by:
Both grids displays fine. But the problem is only parent datagrid sorting works fine but when i clik on child datagrid for sorting it gives me error: NullReferenceException error Any...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.