table selectedrow

Discussion in 'C#' started by jamescw, Jul 24, 2006.

  1. #1
    hihi..

    how can i do a hightlight to the table row when i clicked on the selected row?

    jamescw
    ???
     
    jamescw, Jul 24, 2006 IP
  2. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #2
    explain in more details, you may do it with CSS and/or JavaScript also and not ASP
     
    ludwig, Jul 24, 2006 IP
  3. web_guy

    web_guy Peon

    Messages:
    32
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hey this is client side what u r talking about ....

    U dont need ASP ... use Javascript or CSS ...

    Can u throw light on how u like to highlight ...
     
    web_guy, Jul 25, 2006 IP
  4. Darrin

    Darrin Peon

    Messages:
    123
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I'm going to take a guess based on the title of your request. If you are by chance using a datagrid in dotNet which has a selectedRow property, you can set the color properties of the selectedRow in the Properties of the grid control.

    It will happen client side with javascript, but it will be done for you by setting it in the dotNET IDE.
     
    Darrin, Jul 25, 2006 IP
  5. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #5
    to do it clientside, create a css class in your stylesheet like:
    .active td {background:red;}
    .general td {background:green;}

    then add this to a javascript block
    function activate(obj) { obj.className = 'active'; }

    then in your html you can do:
    <table cellspacing="0" border="1" cellpadding="0">
    <tr onclick="activate(document.getElementByID('tr1'))" id="tr1" class="general">
    <td>hello</td>
    <td>world</td>
    </tr>
    <tr onclick="activate(document.getElementByID('tr2'))" id="tr2" class="general">
    <td>Nice Day</td>
    <td>Hey?</td>
    </tr>
    <table>
     
    ccoonen, Jul 25, 2006 IP