0

私は使用しています

ClientScript.RegisterStartupScript(this.GetType(), "pop", newWin, true); 

ポップアップ ウィンドウを開きます。

この行の後にいくつかのコード行があります。しかし、ポップアップを閉じた後にそれらのコードを実行する必要があります。すぐにではありません。
解決策はありますか?

ボタン クリック イベント:

 private void button_Click(object sender, EventArgs e)
        {

            string queryString = "WebForm2.aspx";
            string newWin = "window.open('" + queryString + "');";

            ClientScript.RegisterStartupScript(this.GetType(), "pop", newWin, true);

                ((Button)sender).Enabled = false;

        }

ボタンクリック ポップアップページを開きます。

4

1 に答える 1

1

次のように使用できますOnClientClick:-

<asp:Button ID="btnSave" runat="server" Text="Save"
    OnClientClick="javascript:return myFunction()" OnClick="btnSave_Click" /> 

    function myFunction() {

             if (confirm("Are you sure you want to Continue ?")) 
             {
                 return true;
             }
             else
             {
                 return false;
             }
      }

またはコードビハインドからこれを試してください:-

Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "myFunction();", true);

また

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", "<script type='text/javascript'>myFunction();</script>", false);
于 2014-05-15T11:43:34.747 に答える