0
我用複選框的gridview,我需要創建一個表格列出來檢查gridview中的任何複選框。我需要幫助才能使用javascript獲取gridview的選定行。如何創建表格行選擇gridview複選框使用javascript
GridView的源代碼
<asp:GridView ID="GrdCustomer" runat="server" BorderColor="#999999" CellPadding="3"
ForeColor="Black" GridLines="Vertical" Width="640px" AllowPaging="True" AutoGenerateColumns="False"
OnRowDataBound="GrdCustomer_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="Select" ItemStyle-Width="50px">
<ItemTemplate>
<input id="selector" onclick="javascript:bindToList(this);selectCustomers();" runat="server" type="checkbox" />
</ItemTemplate>
<HeaderTemplate>
<input id="selector" onclick="javascript:SelectDeselectAllCheckboxes(this);selectCustomers(); " runat="server"
type="checkbox" />
</HeaderTemplate>
<ItemStyle Width="50px" HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="Salutation" HeaderText="Salutation">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Name" HeaderText="Client Name">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Email">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Title" HeaderText="Title">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Id" HeaderText="Id" />
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<PagerStyle BackColor="#999999" ForeColor="Black" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#CCCCCC" />
</asp:GridView>
Basic腳本調用的複選框檢查狀態(只啓動)
function selectCustomers() {
alert("Hey I'm over here!!!");
}
謝謝你......這是'parentElement' – NewBie 2012-07-11 07:13:05