私はWeb開発に不慣れなので、まだ基礎を学んでいます。
ASP .NET ページに jQuery を追加したいだけです。
ヘッダーでは、必要なものを参照しています。
<head id="Head1" runat="server">
<link href="Content/Site.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="Scripts/jquery-2.0.2.js" ></script>
<script type="text/javascript" src="~/HeaderCheckBoxSelections.js"></script>
</head>
これは~/HeaderCheckBoxSelections.js
次のようになります。
function SelectAllCheckBoxes(cbSelect) {
$('#<%=gvShows.ClientID%>').find("input:checkbox").each(function() {
if (this != cbSelect) {
this.checked = cbSelect.checked;
}
});
}
イベントはこれによってトリガーされます。
<HeaderTemplate>
<asp:CheckBox ID="cbSelectAll" runat="server" onclick="javascript:SelectAllCheckBoxes(this);"/>
</HeaderTemplate>
しかし、チェックボックスをクリックすると、次のように表示されます。
未処理の例外...
0x800a1391 - JavaScript runtime error: 'SelectAllCheckBoxes' is undefined.
ここで何か不足していますか?jQuery を適切に参照していませんか?