showModalDialog 関数を使用して、ASP.NET ページであるポップアップ ウィンドウを開きます。ドロップダウン リストでいくつかのオプションを選択した後、window.ReturnValue を入力して [OK] ボタンを押します。モーダル ポップアップ ウィンドウは閉じますが、戻り値を C# コード ビハインドに渡して先に進む方法がわかりません。
コードは次のとおりです。
ポップアップ ウィンドウを開く:
function ClientItemClicked(sender, eventArgs)
{
if (eventArgs.get_item().get_value() == "excel")
{
var retVal = window.showModalDialog("ExportToExcelChoice.aspx", null, "dialogWidth: 400; dialogHeight: 200; center: yes; resizable: no;");
}
}
ポップアップ ウィンドウを閉じます。
function ReturnValue() {
var choice = document.getElementById("DropDownList1").value;
if ((window.opener != null) && (!window.opener.closed)) {
window.ReturnValue = choice;
var result = window.ReturnValue;
}
window.close();
}
私はFirefoxを使用しています。