2013-05-07 132 views
0

我已经写了一个代码来打开一个页面作为模态弹出。它工作正常。但当页面打开为对话框,我点击打开的页面的ASP按钮,它会导致页面产生在窗口..父页面消失...我如何解决这个问题,如果我做回发在弹出的页面中,它也应该保持在主页面中弹出。按钮点击里面的jquery弹出窗口产生窗口

当我点击在Payment_Delivery_Scheduling.aspx它会导致页面在浏览器页面重定向的按钮。

function openPaymentAndDeliveryModel(id) { 
      var windowWidth = $(window).width()/1.25; 
      var windowHeight = $(window).height() /1.5; 
      $('#popup').load("Payment_Delivery_Scheduling.aspx?id=" + id + "", function() { 

      }); 
      $('#popup').dialog({ modal: true, height: windowHeight, width: windowWidth }); 
     } 
+0

我认为你必须处理这一个Ajax调用上的弹出按钮,点击和做的事情。 – 2013-05-07 10:07:55

+0

如何做到这一点?你能给一些细节... – 2013-05-07 10:14:26

回答

0

嘿萨钦示例代码

$("#btnSubmit").live("click", function (e) { 
    if ($('#txtPwd').val().length < 1) { 
     $('#lblResponse').text('Please enter password to move ahead.').addClass("fail-message"); ; 
     $('#txtPwd').focus(); 
    } else { 
     callAjax($('#txtPwd').val()); 
     e.preventDefault(); 
    } 
}); 

function callAjax(hashVal) { 
var address = "Home.aspx"; 
$.ajax({ 
    type: 'POST', 
    url: address, 
    data: { pwd: hashVal }, 
    beforeSend: function() { 
     // this is where we append a loading image 
     $('#ajax-panel').html('<div class="loading"><img src="images/loading.gif" alt="Loading..." /></div>'); 
    }, 
    success: function (data) { 
     // successful request; do something with the data 
     $('#ajax-panel').empty(); 
     var actualData = data.trim().split('~'); 

     $("#lblResponse").html(actualData[0]); 
     $('#txtPwd').val(''); 
     if (actualData[1] == "true") { 
      window.location.href = window.referer = $('#lnkMyCorner').attr('href'); 
     } 

    }, 
    error: function() { 
     // failed request; give feedback to user 
     $('#ajax-panel').html('<p class="error"><strong>Oops!</strong> Try that again in a few moments.</p>'); 
    } 
}); 
} 

希望它可以帮助你

+0

是的,谢谢..但我需要使网络方法为静态的权利?当我点击按钮时,我想填充我的GridView。如果我让方法静态我不能访问gridview ..任何想法如何做? – 2013-05-08 04:41:31

+0

你想通过点击放置在popup中的按钮来填充网格。你想通过ajax调用来填充网格吗? – 2013-05-08 06:00:17

+0

是的,这就是我想要实现的。 – 2013-05-08 07:40:04

相关问题