私は、ASP.NET、Bootstrap、およびjQueryを使用してデータを表示および編集しています。javascript onClickがポストバック後に動作しない
データが検索され、ASP.NETコードによって返され、データを更新するコントロールの更新パネルが更新されます。
私は、ブートストラップタブをタブ(0)からタブ(1)に移動するHTMLパネルをアップデートパネルの外に持っています。
データを検索する前にボタンを押すと、onclickイベントが発生し、必要なデータをすべて完了していないという警告が表示されます。
データを検索して更新パネルを更新すると、onclickイベントは発生しません。
ページの任意の場所をクリックしてボタンを押すと、onclickイベントが発生し、次のタブに移動します。
Chromeでは、更新パネルが更新された後でも、onclickイベントが正しく発生します。
私はjQueryの機能を設定するには、HTMLの先頭に次があります。
<script type="text/jscript" language="javascript">
$(document).ready(startUp);
</script>
javascriptのは、私が問題になるとは思わない別のファイル、です。
function firstButtonClick(move) {
if (move = 1) {
$(".nav-tabs > .active").next("li").find("a").trigger("click");
}
}
Iは、ユーザが実際にそれを更新できるように更新した後に実行されるコードを停止するためにパラメータを追加しました。
これは、タブとボタンと更新パネルのコードです:
<div id="mnuSupporterDetails" class="tab-pane fade in active">
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
<div class="col-lg-3">
Supporter Details
</div>
<div class="col-lg-8">
<div class="row">
<div class="pull-right">
<%--<a class="btn btn-default btnPrevious">Previous</a> --%>
<a class="btn btn-success" onclick="firstButtonClick(1)">Next</a>
</div>
</div>
</div>
<div class="col-lg-1">
</div>
</div>
</div>
<div class="panel-body">
<asp:UpdatePanel ID="uppContactDetails" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<script type="text/javascript">
Sys.Application.add_load(firstButtonClick(0));
</script>
<div class="row">
<div class="col-lg-3">
</div>
<div class="col-lg-6">
<div class="row">
<label for="inpSupporterNumber">
Supporter Number:</label>
<div class="input-group">
<input type="text" class="form-control summary" runat="server" id="inpSupporterNumber"
placeholder="Supporter Number" maxlength="10" />
<span class="input-group-btn">
<button class="btn btn-primary" id="btnSearchContacts" runat="server" type="submit">
Search</button>
</span>
</div>
<label for="inpTitle">
Title:</label>
<input type="text" class="form-control summary" runat="server" id="inpTitle" placeholder="Title"
required="true" maxlength="50" />
<label for="inpForename">
Forename:</label>
<input type="text" class="form-control summary" runat="server" id="inpForename" placeholder="Forename"
required="true" maxlength="30" />
<label for="inpSurname">
Surname:</label>
<input type="text" class="form-control summary" runat="server" id="inpSurname" placeholder="Surname"
required="true" maxlength="30" />
<label for="inpAddressLine1">
Address:</label>
<%--<div class="input-group">--%>
<input type="text" class="form-control summary" runat="server" id="inpAddressLine1"
placeholder="Address Line 1" required="true" maxlength="60" />
<%--<span class="input-group-btn">--%>
<%--<button class="btn btn-primary" id="btnQAS" type="button" data-toggle="modal" data-target="#mdlQAS">--%>
<%-- <i class="glyphicon glyphicon-home"></i>--%>
<%--</button>--%>
<%--</span>--%>
<%--</div>--%>
<label for="inpAddressLine2">
</label>
<input type="text" class="form-control summary" runat="server" id="inpAddressLine2"
placeholder="Address Line 2" maxlength="35" />
<label for="inpAddressLine3">
</label>
<input type="text" class="form-control summary" runat="server" id="inpAddressLine3"
placeholder="Address Line 3" maxlength="35" />
<label for="inpAddressLine4">
</label>
<input type="text" class="form-control summary" runat="server" id="inpAddressLine4"
placeholder="Address Line 4" maxlength="35" />
<label for="inpAddressLine5">
</label>
<input type="text" class="form-control summary" runat="server" id="inpAddressLine5"
placeholder="Address Line 5" maxlength="35" />
<label for="inpPostCode">
Post Code:</label>
<input type="text" class="form-control summary" runat="server" id="inpPostCode" placeholder="Post Code"
required="true" maxlength="8" />
<label for="inpCountry">
Country:</label>
<input type="text" class="form-control summary" runat="server" id="inpCountry" placeholder="Country"
maxlength="42" />
</div>
<div class="row">
<div class="form-group">
<label for="inpTelephoneNumber">
Telephone Number:</label>
<input type="text" class="form-control summary" runat="server" id="inpTelephoneNumber"
placeholder="Phone Number" maxlength="20" />
<label for="inpEmailAddress">
EMail Address:</label>
<input type="text" class="form-control summary" runat="server" id="inpEmailAddress"
placeholder="EMail Address" maxlength="100" />
</div>
</div>
</div>
<div class="col-lg-3">
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="panel-footer">
<div class="row">
<div class="col-lg-3">
</div>
<div class="col-lg-8">
<div class="row">
<div class="pull-right">
<a class="btn btn-success btnNext">Next</a>
</div>
</div>
</div>
<div class="col-lg-1 ">
</div>
</div>
</div>
</div>
</div>
任意の助けをいただければ幸いです。
Sean