asp.net - change color of row selected in repeater with javascript -


i have repeater linkbutton. so, intend use javascript when click linkbutton, in addition able make data editing, can change color of selected row.

but not know how this. can add onclientclick event? how can know line selected able change color?

thank you...

<asp:repeater id="repeater1" runat="server" >   <headertemplate>         <table>    </headertemplate>       <itemtemplate>        <tr class="trclass" style="width:100px">         <td>             <asp:linkbutton id="linkbtn1" oncommand="lbedit_command"                     commandargument='<%# eval("id")%>'                     commandname="edit" runat="server">                 </asp:linkbutton>         </td>       </tr>    </itemtemplate>    <footertemplate>         </table>    </footertemplate> </asp:repeater> 

you can use onclientclick event. inside client-click "this" refers element caused event, can try like:

<asp:linkbutton id="linkbtn1" oncommand="lbedit_command"      commandargument='<%# eval("id")%>'     commandname="edit" runat="server">     onclientclick = "this.parentelement.style.backgroundcolor = 'blue'" </asp:linkbutton> 

this select parent element of clicked link td , set it's background color blue. (probably better) alternative assign css class instead of assigning color directly.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -