I am trying to implement a confirmation dialog box for when a user wants to delete their account. This dialog box requires the user to enter their password in a textbox. However, I am struggling with catching the postback event and executing the relevant method in the code behind.
Below is my current code:
The dialog box I have set up:
<div id="dialog" title="Confirmation Required">
Are you sure you want to proceed?
Password:<asp:TextBox id="remove_password" TextMode="Password" runat="server"></asp:TextBox>
</div>
The button that triggers the dialog:
<asp:LinkButton ID="lb_remove" Text="Delete Account" runat="server" OnClientClick="javascript: $('#dialog').dialog('open'); return false;" ClientIDMode="Static" />
The script I have written:
$().ready(function() {
$("#dialog").dialog({
autoOpen: false,
modal: true,
bgiframe: true,
width: 400,
height: 300,
buttons: {
'Delete': function() {
//do something
//What should go here?
//Do I need to pass the textbox value here,
//or should I use FindControl in the codebehind?
//
},
'Cancel': function() {
$(this).dialog('close');
}
}
})
});
Any assistance on this matter would be greatly appreciated. Thank you.