ASP.NET用户控件和jQuery对话框 [英] ASP.NET user control and jQuery dialog

查看:106
本文介绍了ASP.NET用户控件和jQuery对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的页面上,我得到以下用户控件:

 < div class =editFormDialogstyle =display: none; font-size:12px;> 
< mm:Form ID =editUCShowCreateButton =falseShowEditButton =truerunat =server/>
< / div>

这个UC有一个公共属性,它接收一个DataSet,并更新UC中的某些字段。 p>

所以当我在我的页面上按下一个按钮时,它会在UC上调用此属性,UC将从DataSet中更新数据。



到目前为止这么好。问题出现在我希望UC成为一个jQuery UI对话框时。



首先创建对话框:

  $(document).ready(function(){
$('。editFormDialog')。对话框({
autoOpen:false,
height: 700,
width:780,
modal:true,
bgiframe:true,
标题:'Rediger',
打开:function(type,data){
$(this).parent()。appendTo(form);
$(this).css('display','block');
}
}) ;
});

我不能打开按钮(这不是一个ASP.NET按钮,纯HTML):

  $('#btnEdit')。live('click',function(){
$('。editFormDialog')。对话框('open');
});

对话框打开,但UC不包含正确的数据。
当页面加载时,UC将使用默认数据进行更新。然后用户点击按钮,数据更改,但UC不会更新。它仍然包含默认数据。这个问题。



你有什么想法吗?



帮助将不胜感激! >

解决方案

当您调用该属性时,会发生什么(我会假设你的意思是它是一种方法)?页面是否执行回发?如果是这样的话,那么当您将jQuery混合到场景中时,也许回覆会被阻止?


On my page I got the following user control:

<div class="editFormDialog" style="display: none; font-size: 12px;">
    <mm:Form ID="editUC" ShowCreateButton="false" ShowEditButton="true" runat="server" />
</div>

This UC has a public property that takes a DataSet, and updates some fields in the UC.

So when I push a button on my page, it calls this property on the UC, and the UC gets updated with data from the DataSet.

So far so good. The problem arise when I want the UC to be a jQuery UI Dialog.

First I create the dialog:

$(document).ready(function() {
    $('.editFormDialog').dialog({
        autoOpen: false,
        height: 700,
        width: 780,
        modal: true,
        bgiframe: true,
        title: 'Rediger',
        open: function(type, data) {
            $(this).parent().appendTo("form");
            $(this).css('display', 'block');
        }
    });
});

And I wan't it to open on a button push (this is not an ASP.NET button, plain HTML):

$('#btnEdit').live('click', function() {
    $('.editFormDialog').dialog('open');
});

The dialog opens, but the UC does not contain the correct data. When the page loads, the UC is updated with default data. Then the user clicks a button, and the data changes but the UC isn't updated. It still contains the default data. Thats the problem.

Do you have any idea why?

Help will be much appreciated!

解决方案

Exactly what happens when you "call the property" (I would assume you mean it's a method)? Does the page perform a postback? If that's the case, maybe the postback is getting blocked somehow when you mix jQuery into the scenario?

这篇关于ASP.NET用户控件和jQuery对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆