Home All Groups Group Topic Archive Search About

How can I select a row by clicking on ANY column

Author
14 Feb 2007 7:14 PM
John Wilmot
I am using the following to highlight a row when mousing over a GridView:

e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='Silver'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='White'");

Now, what I would like to do would seem simple, but apparently is not. I
would like to be able to select the row by clicking on any column within it.
Does anyone know the best way to do this?

Author
15 Feb 2007 3:38 PM
Darren Sim
Unfortuneately the gridview component doesn't come with a fullrowselect
property that would be too easy :)

To get the behaviour you require you need to do a bit of work, see
http://msdn.microsoft.com/msdnmag/issues/01/05/cutting/
if you search for "full row select" it should take you too the relevant
section.

HTH
Darren Sim



Show quoteHide quote
"John Wilmot" <nfr@nospam.com> wrote in message
news:uRPdryGUHHA.4076@TK2MSFTNGP05.phx.gbl...
>I am using the following to highlight a row when mousing over a GridView:
>
> e.Row.Attributes.Add("onmouseover",
> "this.style.backgroundColor='Silver'");
> e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='White'");
>
> Now, what I would like to do would seem simple, but apparently is not. I
> would like to be able to select the row by clicking on any column within
> it. Does anyone know the best way to do this?
>
Author
15 Feb 2007 6:35 PM
John Wilmot
Thanks, this is helpful.

Strange that MS would neglect such an obvious need. I wonder what the reason
is?

Show quoteHide quote
"Darren Sim" <darr***@sirius.co.uk> wrote in message
news:%23d9zhdRUHHA.1200@TK2MSFTNGP04.phx.gbl...
> Unfortuneately the gridview component doesn't come with a fullrowselect
> property that would be too easy :)
>
> To get the behaviour you require you need to do a bit of work, see
> http://msdn.microsoft.com/msdnmag/issues/01/05/cutting/
> if you search for "full row select" it should take you too the relevant
> section.
>
> HTH
> Darren Sim
>
>
>
> "John Wilmot" <nfr@nospam.com> wrote in message
> news:uRPdryGUHHA.4076@TK2MSFTNGP05.phx.gbl...
>>I am using the following to highlight a row when mousing over a GridView:
>>
>> e.Row.Attributes.Add("onmouseover",
>> "this.style.backgroundColor='Silver'");
>> e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='White'");
>>
>> Now, what I would like to do would seem simple, but apparently is not. I
>> would like to be able to select the row by clicking on any column within
>> it. Does anyone know the best way to do this?
>>
>
>