I need to figure out how, in code, to determine a bound datagrid's currently
sorted column and then to change it. The result will be used in a context
menu with an Arrange By -> list similar to Outlook.

Any ideas?

Brian

Re: Determine datagrid's currently sorted column by Dmitriy

Dmitriy
Wed Sep 24 03:41:53 CDT 2003

Hi Brian,

You can obtain the underlying System.Data.DataView through the corresponding
CurrencyManager's List property and the query the DataView for its Sort
property contents.
You will obviously get data column name with this approach, and I hope this
is what you really need. To change the sorting manually, you will probably
update the Sort property value with a new column name and sort sense.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Brian Vallelunga" <bgvallelunga@starpower.net> wrote in message
news:epCSGRhgDHA.3700@TK2MSFTNGP11.phx.gbl...
> I need to figure out how, in code, to determine a bound datagrid's
currently
> sorted column and then to change it. The result will be used in a context
> menu with an Arrange By -> list similar to Outlook.
>
> Any ideas?
>
> Brian
>
>


Re: Determine datagrid's currently sorted column by Brian

Brian
Wed Sep 24 17:06:10 CDT 2003

Thanks. I think this will work, but it is a bit obtuse because of the table
style and DataGridColumnStyles I have setup that map field names to header
text. Question: is there an easy way, given a table style and a header text
of a column to get the underlying field name? And vise-versa: given a field
name, can I get the column style header text? Right now I have to loop to
find what I'm looking for and I think there must be an easier way.

Thanks again,

Brian



"Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam-please.hotpop.com> wrote
in message news:ut$h3engDHA.2328@TK2MSFTNGP09.phx.gbl...
> Hi Brian,
>
> You can obtain the underlying System.Data.DataView through the
corresponding
> CurrencyManager's List property and the query the DataView for its Sort
> property contents.
> You will obviously get data column name with this approach, and I hope
this
> is what you really need. To change the sorting manually, you will probably
> update the Sort property value with a new column name and sort sense.
>
> --
> Dmitriy Lapshin [C# / .NET MVP]
> X-Unity Test Studio
> http://x-unity.miik.com.ua/teststudio.aspx
> Bring the power of unit testing to VS .NET IDE
>
> "Brian Vallelunga" <bgvallelunga@starpower.net> wrote in message
> news:epCSGRhgDHA.3700@TK2MSFTNGP11.phx.gbl...
> > I need to figure out how, in code, to determine a bound datagrid's
> currently
> > sorted column and then to change it. The result will be used in a
context
> > menu with an Arrange By -> list similar to Outlook.
> >
> > Any ideas?
> >
> > Brian
> >
> >
>