This is a multi-part message in MIME format.

------=_NextPart_000_0008_01C3D618.44E3BA00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Dear Frnds

I m using DataGrid Control in my project.=20

On the mouse Up event i get the information from DataGrid row using =
Currencty Manager. code is below=20

private void dgPassengers_MouseUp(object sender, =
System.Windows.Forms.MouseEventArgs e)

{

string tHistoryId;

if (dsInquiry.Tables["QueryHistory"].DefaultView.Count > 0)

{

HistoryId =3D =
((DataRowView)cmQuery.Current).Row["HistoryID"].ToString();

this.HistoryId =3D tHistoryId;

this.DoAction(InquiryActions.EditQuery);

}

}

it is working fine. but when i click on the Column header it sorts the =
Grid and it should also give the information of the row where the Record =
pointer is located. but it gives wrong information.

or we can say it doesn't move the record pointer to the row it was =
pointing before sorting.

please give suggestion=20

thanks and regards=20

Mubashar Ahmad

------=_NextPart_000_0008_01C3D618.44E3BA00
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>Dear Frnds</DIV>
<DIV>&nbsp;</DIV>
<DIV>I m using DataGrid Control in my project. </DIV>
<DIV>&nbsp;</DIV>
<DIV>On the mouse Up event i get the information from DataGrid row using =

Currencty Manager. code is below </DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff size=3D2>
<P>private</FONT><FONT size=3D2> </FONT><FONT color=3D#0000ff=20
size=3D2>void</FONT><FONT size=3D2> dgPassengers_MouseUp(</FONT><FONT =
color=3D#0000ff=20
size=3D2>object</FONT><FONT size=3D2> sender, =
System.Windows.Forms.MouseEventArgs=20
e)</P>
<P>{</P>
<P></FONT><FONT color=3D#0000ff size=3D2>string</FONT><FONT size=3D2> =
tHistoryId;</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2>=20
(dsInquiry.Tables["QueryHistory"].DefaultView.Count &gt; 0)</P>
<P>{</P></FONT><FONT size=3D2>
<P>HistoryId =3D =
((DataRowView)cmQuery.Current).Row["HistoryID"].ToString();</P>
<P></FONT><FONT color=3D#0000ff size=3D2>this</FONT><FONT =
size=3D2>.HistoryId =3D=20
tHistoryId;</P>
<P></FONT><FONT color=3D#0000ff size=3D2>this</FONT><FONT=20
size=3D2>.DoAction(InquiryActions.EditQuery);</P>
<P>}</P></FONT><FONT size=3D2>
<P>}</P>
<P>it is working fine. but when i click on the Column header it sorts =
the Grid=20
and it should also give the information of the row where the Record =
pointer is=20
located. but it gives wrong information.</P>
<P>or we can say it doesn't move the record pointer to the row it was =
pointing=20
before sorting.</P>
<P>please give suggestion </P>
<P>thanks and regards </P>
<P>Mubashar Ahmad</P></FONT></DIV></BODY></HTML>

------=_NextPart_000_0008_01C3D618.44E3BA00--

Re: DataGrid - Sorting Problem by Dmitriy

Dmitriy
Fri Jan 09 10:15:21 CST 2004

Hello,

The data grid won't retain its current position after being re-sorted. You
should restore the position manually, possibly by remembering a unique row
primary key and searching the row's position in the updated data view
accessible through the CurrencyManager's List property by the stored primary
key.

--
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


Re: DataGrid - Sorting Problem by Mubashar

Mubashar
Sun Jan 11 23:52:58 CST 2004

Thanks Dmitriy Lapshin

your suggestion is quit reasonable now please let me know how can i capture
sort event. i dont think that datagrid provides such event. and tell me also
is it a event of dataGrid or
DataGridColumn.

thanks once again and Regards

Mubashar Ahmad



"Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam-please.hotpop.com> wrote
in message news:O0crHvs1DHA.3496@TK2MSFTNGP11.phx.gbl...
> Hello,
>
> The data grid won't retain its current position after being re-sorted. You
> should restore the position manually, possibly by remembering a unique row
> primary key and searching the row's position in the updated data view
> accessible through the CurrencyManager's List property by the stored
primary
> key.
>
> --
> 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
>



Re: DataGrid - Sorting Problem by Dmitriy

Dmitriy
Mon Jan 12 02:39:15 CST 2004

There's no dedicated event. You can capture the grid's MouseDown event and
determine whether the user has clicked on a column header by using the
grid's HitTest method.

--
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

"Mubashar Ahmad" <mubashar2001@yahoo.com> wrote in message
news:uJqYPBN2DHA.2888@tk2msftngp13.phx.gbl...
> Thanks Dmitriy Lapshin
>
> your suggestion is quit reasonable now please let me know how can i
capture
> sort event. i dont think that datagrid provides such event. and tell me
also
> is it a event of dataGrid or
> DataGridColumn.
>
> thanks once again and Regards
>
> Mubashar Ahmad
>
>
>
> "Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam-please.hotpop.com> wrote
> in message news:O0crHvs1DHA.3496@TK2MSFTNGP11.phx.gbl...
> > Hello,
> >
> > The data grid won't retain its current position after being re-sorted.
You
> > should restore the position manually, possibly by remembering a unique
row
> > primary key and searching the row's position in the updated data view
> > accessible through the CurrencyManager's List property by the stored
> primary
> > key.
> >
> > --
> > 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
> >
>
>