开发者

jQuery UI Dialog with usercontrol and postback

开发者 https://www.devze.com 2023-02-21 10:18 出处:网络
I have a jQuery UI dialog which has a usercontrol in it, which I get by .load of the page it is in. It is a simple calculator.

I have a jQuery UI dialog which has a usercontrol in it, which I get by .load of the page it is in. It is a simple calculator. You pick several numbers and then开发者_开发技巧 click a button, a postback happens and finally you get the result in to two lables. When I click the button inside the dialog, the postback happens and I see the result in the original page, not the dialog. I understand the logic, but I'm looking to see if there is a way around it?


If you are doing some server side processing that make an ajax call back to the server and on success, update your UI in the dialog represented by the div in your page, and do not close the dialog.

$.ajax({

  // make the request to an endpoint that will take your form data
  url: 'ajax/test.asmx',
  success: function(data) {

    // update an element with the data that the service has sent back, in this case the 
    // results of the calculation
    $('.result').html(data);
  }
});

If you do not need any server side processing then you could write the calculation in JavaScript.

0

精彩评论

暂无评论...
验证码 换一张
取 消