The example in this article describes the method for Repeart to select an entire row in asp.net. Share to everyone for your reference.
The implementation methods are as follows:
Copy Code code as follows:
<asp:repeater runat= "Server" id= "Rpt_student" >
<HeaderTemplate>
<table>
<tr id= "tr_<% #this .rpt_student.items.count%>" onclick= ' Tr_click (tr_<% #this. rpt_student.item.count% >) ' >
<td> name </td>
<td> School Number </td>
<td> Achievements </td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr >
<td><% #Eval ("sname")%></td>
<td><% #Eval ("SID")%></td>
<td><% #Eval ("Sscore")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
The JQ code is as follows:
Copy Code code as follows:
<script type= "Text/javascript" >>
function Tr_click (ID) {
if ($ ("#" + ID). attr ("style") = = "Background:red") {
$ ("#" + ID). attr ("style", "background:white");
} else {
$ ("#" + ID). attr ("style", "background:red");
}
}
</script>
I hope this article will help you with the ASP.net program design.