1

情報が送信されたことを示すメッセージをユーザーに表示するポップアップがあります。ポップアップ div の ID NewCustomerStatusPopUp,情報がデータベースに正常に挿入されたときにこのポップアップを表示したいので、javascript を呼び出すにはどうすればよいですかすべての情報が送信されたときにポップアップを表示する機能。これを行う方法を教えてください。これが私のポップアップです

<div id="NewCustomerStatusPopUp">
<asp:Label ID="lblStatus" Text="" runat="server"/>
</div>

CSS:

#NewCustomerStatusPopUp
    {
    position: fixed;
    width: 300px;
    height: 250px;
    top: 50%;
    left: 50%;
    margin-left:-255px;
    margin-top:-150px;
    border: 10px solid #9cc3f7;
    background-color:White; 
    padding: 10px;
    z-index: 102;
    font-family:Verdana;
    font-size: 10pt;
    border-radius:10px;
    -webkit-border-radius:20px;
    -moz-border-radius:20px;

    }

どんな助けでも大歓迎です。

ありがとう。

4

2 に答える 2

1

サーバーから JavaScript 関数を呼び出すには、以下を使用できますRegisterStartipScript:
挿入クエリの後に、このコードを記述します

ClientScript.RegisterStartupScript(GetType(), "id", "callMyJSFunction()", true);

<script type="text/javascript">
function callMyJSFunction()
{
    alert("Record inserted sucessfully.");
}
于 2012-06-07T05:43:49.150 に答える
1

挿入を実行するコード ビハインドにクリック イベント ハンドラーがある場合、JS は必要ありません。パネルで div をラップします。

<asp:Panel ID="pnlStatus" Visible="false" >
    <div id="NewCustomerStatusPopUp">
      <asp:Label ID="lblStatus" Text="" runat="server"/>
    </div>
</asp:Panel>

コード ビハインドで、新しい顧客が正常に追加されたことをアサートしたら、

pnlStatus を可視に設定します。

pnlStatus.Visible = true;
于 2012-06-07T05:46:22.570 に答える