開発マシンで正常に動作する次のコードがあります。しかし、IIS にデプロイすると起動the .click()
しません。
ドロップダウン ボックスがあり、ステータスが選択されている場合、次のコードを追加して RadWindow を開きます
if (ddlStatusID.SelectedValue.ToString() == "2") btnUpdateStatus.Attributes.Add("onclick", "return OpenWindow2('" + ResolveUrl("~/Request/AddBillableTime.aspx? RequestId=" + RequestId.ToString()) + "','650','320');"); else btnUpdateStatus.Attributes.Add("onclick", "");
ポップアップページで、ユーザーが追加したボタンをクリックすると、次のようになります
ClientScript.RegisterStartupScript(this.GetType(), "CloseWindow", "ClosePopup();", true);
これは ClosePopup JavaScript です。
function ClosePopup() {
//debugger;
alert('This is before closing the window');
var oWindow = GetRadWindow();
oWindow.argument = null;
oWindow.close();
alert('This is after closing the window');
oWindow.BrowserWindow.ButtonClick();
}
メイン ウィンドウには、上記の JavaScript の最後の行で呼び出される次の JavaScript があります。
function ButtonClick() { //debugger; alert('This is before button click!'); var btnUpdateStatus = document.getElementById('ctl00_ContentPlaceHolder1_btnUpdateStatus'); alert('This is getting the button!'); btnUpdateStatus.setAttribute("onclick", ""); alert('This is setting the button!'); btnUpdateStatus.click(); alert('This is after clicking the button!');
}
アラートを使用して、javascript 関数がどこまで実行されているかを確認しました。
Visual Studio を使用して実行したり、ローカル IIS サーバーでホストしたりすると、機能全体が正常に動作します。しかし、サーバーにデプロイすると、click() イベントの発生が停止します。
コードに何か問題がある場合はお知らせください。