user3344443
user3344443

Reputation: 475

JQUERY Dialog handle postback

I have a JQuery dialog in asp.net

Once I clicked the button, the dialog pop up then disappears immediately. I know there is a post-back issue, butI don't know how to handle it? Say using hidden field?

code for the dialog

Upvotes: 0

Views: 148

Answers (1)

Nitin Varpe
Nitin Varpe

Reputation: 10694

Your button is asp.net server control i.e its submit button which causes form submission and eventually postback.

Change it to normal html button

<input type="button" value="open dialog" id="btn"/>

then open popup on click of that button

$('#btn').click(function(){
//open dialog
});

Or if you dont want to replace server control with html control, you can return false from click function

CODE

  ......
 {
    $('#dialog').dialog('open');
    return false;
    });

Upvotes: 2

Related Questions