I want to highlight the first row in the repeater while the repeater loads on the page and then highlighting a row on mouse click.
<asp:Repeater ID="rptTest" runat="server">
<HeaderTemplate>
<table border="1" cellpadding="4" cellspacing="0">
<tr>
<th>Room</th>
<th>Board</th>
<th>Status</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem, "Room")%></td>
<td><%# DataBinder.Eval(Container.DataItem, "Board")%></td>
<td><%# DataBinder.Eval(Container.DataItem, "Status")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
With jQuery : (you said , if possible)
var _=$("table tr:gt(0)");
_.first().css('background-color','yellow');
_.on('click',function (){
_.css('background-color','');
$(this).css('background-color','yellow');
});
http://jsbin.com/ukoXeNEy/4/edit
But to get it done with your aspnet ID's :
var _=$("#<%=rptTest.ClientID %> tr:gt(0)");
_.first().css('background-color','yellow');
_.on('click',function (){
_.css('background-color','');
$(this).css('background-color','yellow');
});