Home All Groups Group Topic Archive Search About
Author
2 Apr 2006 11:58 AM
G .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

Author
2 Apr 2006 2:43 PM
Cor Ligthert [MVP]
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



Show quoteHide quote
"G .Net" <nodamnspam@email.com> schreef in bericht
news:ue6dnXQXoprMIbLZRVnygA@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
>
Author
2 Apr 2006 3:15 PM
G .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

Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:encuEOmVGHA.4960@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" <nodamnspam@email.com> schreef in bericht
> news:ue6dnXQXoprMIbLZRVnygA@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
>>
>
>
Author
2 Apr 2006 4:31 PM
Cor Ligthert [MVP]
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

Show quoteHide quote
"G .Net" <nodamnspam@email.com> schreef in bericht
news:opGdnau1dp02d7LZRVnyiQ@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]" <notmyfirstn***@planet.nl> wrote in message
> news:encuEOmVGHA.4960@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" <nodamnspam@email.com> schreef in bericht
>> news:ue6dnXQXoprMIbLZRVnygA@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
>>>
>>
>>
>
>
Author
3 Apr 2006 1:26 PM
G .Net
Thanks Cor

G

Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:uSus5KnVGHA.5172@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" <nodamnspam@email.com> schreef in bericht
> news:opGdnau1dp02d7LZRVnyiQ@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]" <notmyfirstn***@planet.nl> wrote in message
>> news:encuEOmVGHA.4960@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" <nodamnspam@email.com> schreef in bericht
>>> news:ue6dnXQXoprMIbLZRVnygA@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
>>>>
>>>
>>>
>>
>>
>
>