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

Q: DataGrid Sort

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.