0

これをGridviewで動作させることができました。最終的に、クリックしたときに行を強調表示しようとしています。テストのために、アラートを使用しています。

jQuery は次のとおりです。

$(document).ready(function() {
  $('#WhiteRow tr').click(function() {
    event.preventDefault();
    alert("white");
  });

HTMLは次のとおりです。

<asp:Panel ID="GridViewDrillIntoCell_Panel_All"
     runat="server"
     width="2000px" 
     height="380px"
>
<asp:ListView ID="GridViewDrillIntoCell_All" 
     runat="server" 
     ScrollBars="Vertical"
     ItemPlaceholderID= "myItemPlaceHolder" 
     UseAccessibleHeader="True"
     AutoGenerateColumns="false"
     HeaderStyle-CssClass="HeaderCss2" 
     OnSelectedIndexChanged="GV_Scorecard_Tab1_SelectedIndexChanged"
     OnRowDataBound="GridViewDrillIntoCell_All_RowDataBound"
> 
  <LayoutTemplate> 
    <div id="Listview">
      <table border="0" cellpadding="1">
        <tr id="HeadingRow">
          <th id="hcol1" style="width:50px">Client</th>
        </tr>
        <tr>
          <asp:PlaceHolder ID="myItemPlaceHolder" runat="server">
          </asp:PlaceHolder>
        </tr>
      </table>
    </div>
  </LayoutTemplate>
  <ItemTemplate>
    <tr id="WhiteRow">
      <td id="col1" class="ListViewStyle" style="width:50px"> 
        <%# Eval("LMClient")%>
      </td> 
    </tr> 
  </AlternatingItemTemplate>      
</asp:ListView></asp:Panel> 
4

1 に答える 1

0

あなたのセレクターは間違っていると思います。

#WhiteRow trtrの id を持つ要素内にあるすべての要素を選択することを意味しますWhiteRow。したがって、行内の行を探しています。

于 2012-04-12T16:56:56.937 に答える