我需要应用样式并突出显示已排序的标题列。排序是在 rptMyTable_ItemCommand 事件中处理的。我不能使用 gridview,因为显示数据的布局不是常规表格。在 javascript 中,我们有类似 document.getElementById('lbCol1Header').parentNode.style = 'sortedColumnCSS' 如何在代码隐藏中执行此操作?
<table border="0" cellpadding="5" cellspacing="0" width="100%" class="myCSS">
<asp:Repeater ID="rptMyTable" runat="server" OnItemCommand="rptMyTable_ItemCommand">
<HeaderTemplate>
<tr style="font-weight: bolder">
<td>
<asp:LinkButton ID="lbCol1Header" Text="Col1" runat="server" CommandName="sortCol1" />
</td>
<td>
<asp:LinkButton ID="lbCol2Header" Text="Col2" runat="server" CommandName="sortCol2" />
</td>
<td>
<asp:LinkButton ID="lbCol3Header" Text="Col3" runat="server" CommandName="sortCol3" />
</td>
<td>
<asp:LinkButton ID="lbCol4Header" Text="Col4" runat="server" CommandName="sortCol4" />
</td>
<td>
<asp:LinkButton ID="lbCol5Header" Text="Col5" runat="server" CommandName="sortCol5" />
</td>
<td>
<asp:LinkButton ID="lbCol6Header" Text="Col6" runat="server" CommandName="sortCol6" />
</td>
<td>
</td>
<td>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
//Table Data......with nested tables and divs
.
.
.
.
.
</ItemTemplate>
</asp:Repeater>
<tr style="font-weight: bolder">
// doing paging operations here...
</tr>
</table>