0

ユーザーが自分のアカウントを削除したいときに確認ボックスを作成したいのですが、そのために彼は自分のパスワードを(テキストボックスに)挿入する必要があります。しかし、ポストバックイベントをキャッチし、コードビハインドでメソッドを実行する方法がわかりません...
これは私のコードです:

私のダイアログボックス:

<div id="dialog" title="Confirmation Required">
    Are you sure about this?
    Password:<asp:TextBox id="remove_password" TextMode="Password" runat="server"></asp:TextBox>
</div>

ダイアログを呼び出す私のボタン:

<asp:LinkButton ID="lb_remove" Text="Delete Account" runat="server" OnClientClick="javascript: $('#dialog').dialog('open'); return false;" ClientIDMode="Static" />

私のスクリプト:

$().ready(function() { 
        $("#dialog").dialog({ 
            autoOpen: false, 
            modal: true, 
            bgiframe: true, 
            width: 400,
            height: 300,
            buttons: { 
                'Delete': function() { 
                    //do something

                    //what to put here???
                    //i need to pass my textbox value or in 
                    //codebehind i do findcontrol and will work?
                    //
                },
                'Cancel': function() {
                    $(this).dialog('close');
                }
            }
        })
    });

誰か助けてもらえますか?ありがとう。

4

1 に答える 1

0

ポストバックが実行される間にダイアログがポップアップすることはできません。コードビハインドでそれを行おうとしている場合、これを自分で制御することはできません。

 return confirm('Are you sure you want to Delete?');

他の回避策は、これに依存するJavascript/Ajaxことです。

編集:

これを試して

<asp:LinkButton ID="lb_remove" Text="Delete Account" runat="server" OnClientClick="return confirm('Are you sure you want to delete?');" ClientIDMode="Static" />
于 2012-09-14T10:05:07.767 に答える