Format Datagrid appearance with Javascript

Discussion in 'ASP .Net Datagrid Control' started by mkhmer, Apr 11, 2006.

  1. mkhmer

    mkhmer Guest

    Does anybody know how can I format the appearance of DataGrid at clientside
    script (javascript)?
    I try to add the color change to all item whenever mouse is moved on or out
    of that item, moreover I want to show different color when an item is
    selected (clicked) and when other one is click the old selected one must
    clear it color to look same as other unseleted item.

    Here is my code:
    ============
    Sub Custom_Bound(sender As Object, e As DataGridItemEventArgs)
    if e.Item.ItemType = ListItemType.Item or e.Item.ItemType
    =ListItemType.AlternatingItem then
    e.Item.Attributes.Add("onclick",
    "this.style.backgroundColor='black;")
    e.Item.Attributes.Add("onmouseover" ,
    "this.style.color='black';this.style.backgroundColor='#dcdcdc';this.style.cursor='arrow';")
    e.Item.Attributes.Add("onmouseout" ,
    "this.style.color='black';this.style.backgroundColor='white';")
    End If
    End Sub
    ============

    Please help at the line to add "OnClick" event, how can I handle the
    proccess that clear other unselected item before set the current selected
    item into "Black" backgroud color?

    Thanks,
     
    mkhmer, Apr 11, 2006
    #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. bruce barker
    Replies:
    1
    Views:
    1,378
    David
    Aug 13, 2003
  2. Alex
    Replies:
    4
    Views:
    469
    Steven Campbell
    Aug 20, 2003
  3. Alex

    Hyperlink appearance

    Alex, Aug 27, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    370
  4. MrsLeigh

    DataGrid Buttons Appearance

    MrsLeigh, Apr 26, 2006, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    115
    Steve Goodyear
    May 2, 2006
  5. PaulNaude

    Checkbox value in datagrid does not reflect appearance

    PaulNaude, Nov 3, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    181
    Elton Wang
    Nov 4, 2005
Loading...

Share This Page