How can I select a row by clicking on ANY column

Discussion in 'ASP .Net Web Controls' started by John Wilmot, Feb 14, 2007.

  1. John Wilmot

    John Wilmot Guest

    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?
    John Wilmot, Feb 14, 2007
    #1
    1. Advertising

  2. John Wilmot

    Darren Sim Guest

    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" <> wrote in message
    news:...
    >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?
    >
    Darren Sim, Feb 15, 2007
    #2
    1. Advertising

  3. John Wilmot

    John Wilmot Guest

    Thanks, this is helpful.

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

    "Darren Sim" <> wrote in message
    news:%...
    > 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" <> wrote in message
    > news:...
    >>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?
    >>

    >
    >
    John Wilmot, Feb 15, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bazza Formez
    Replies:
    4
    Views:
    390
    Vanni Tomezzoli
    Dec 9, 2004
  2. Replies:
    2
    Views:
    1,313
  3. misiek
    Replies:
    0
    Views:
    2,265
    misiek
    Feb 20, 2006
  4. D
    Replies:
    0
    Views:
    197
  5. Sameeksha
    Replies:
    0
    Views:
    109
    Sameeksha
    Apr 7, 2005
Loading...

Share This Page