Re: Show border around datagrid row on mouseover?

Discussion in 'ASP .Net' started by Anthony Jones, Feb 17, 2009.

  1. "Arch Stanton" <> wrote in message
    news:mOqml.9677$...
    >I have datagrids with alternating colors, and I've been experimenting with
    >jazzing them up with a color change on mouseover. What I'd really like to
    >do instead is to add a border to the datagrid row on mouseover.
    >
    > My mouseover code looks like this:
    >
    > Protected Sub DataGrid_ItemCreated(ByVal sender As Object, ByVal e As
    > System.Web.UI.WebControls.DataGridItemEventArgs)
    >
    > e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='green';")
    > e.Item.Attributes.Add("onmouseout","this.style.backgroundColor='white';")
    >
    > end sub
    >
    > Is there a straightforward way to add a border around the row instead of
    > changing its color? I've been Googling this for two hours, but I can't
    > find anything I can make work.
    >


    Make sure your css for the unadorned TR has a border of the same color as
    the content background say "1px solid white"

    Then:-

    e.Item.Attributes.Add("onmouseenter","this.style.border = '1px solid
    black';")
    e.Item.Attributes.Add("onmouseleave","this.style.border='';")

    (Note you may not want to run code on all bubbled over/outs use the
    non-bubbling enter/leave)



    --
    Anthony Jones - MVP ASP/ASP.NET
     
    Anthony Jones, Feb 17, 2009
    #1
    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. =?Utf-8?B?UGF1bA==?=

    datagrid question border around cells

    =?Utf-8?B?UGF1bA==?=, Dec 6, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    400
    =?Utf-8?B?UGF1bA==?=
    Dec 7, 2004
  2. tshad
    Replies:
    0
    Views:
    2,305
    tshad
    Jan 31, 2005
  3. Carl Gilbert

    TD border color on mouseover

    Carl Gilbert, Jul 18, 2005, in forum: HTML
    Replies:
    1
    Views:
    11,666
    Adrienne
    Jul 18, 2005
  4. phl
    Replies:
    1
    Views:
    4,421
    Martin Jay
    Jun 8, 2006
  5. =?Utf-8?B?QWxleCBNYWdoZW4=?=

    DataGrid Border around earch row

    =?Utf-8?B?QWxleCBNYWdoZW4=?=, Jun 12, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    20,115
Loading...

Share This Page