使用jquery,ajax和silverlight将数据保存到codebehind时出现问题

问题描述:

我想将对话框在页面中的位置保存在.net代码后面.
我已将其放置在ajax脚本中

I want to save the position of the dialogs on the page in the .net code behind.
i have placed this inside an ajax script

<asp:ScriptManager ID="ScriptManager1" runat="server" />
           <asp:UpdatePanel ID="UpdatePanel1" runat="server">
           <Triggers>
               <asp:AsyncPostBackTrigger controlid="Button1" eventname="Click" />
           </Triggers>
               <ContentTemplate>
                   <asp:HiddenField ID="HiddenField1" runat="Server" Value="" />
                   <asp:Button ID="Button1" runat="Server" OnClick="hidden1_Click" Text="submit" />
               </ContentTemplate>
           </asp:UpdatePanel>



每次移动对话框时,将部分保存到HiddenField,然后从Java脚本中单击按钮.



Every time the dialog is moved the porision is saved to HiddenField and the button is clicked from the within the java script

$(document).ready(function () {           
 $(''.ui-dialog-titlebar'').mouseup(function () {
                var a = $(''this'').parent().children(''.ui-dialog-title'').html.valueOf;
                document.getElementById("HiddenField1").value = (page + ";Left=" + $(this).parent().dialog(''widget'').position().left + ";Top=" + $(this).parent().dialog(''widget'').position().top);
                document.getElementById("Button1").click();
            });
        });



该对话框包含silverlight对象,当页面首次加载时,这些对象将代码从隐藏代码传递给这些对象.一切正常,除了当我最小化对话框时,它似乎再次尝试重新加载silverlight对象,但现在变量丢失了,它将无法正常工作.

当我不使用页面上的Ajax脚本时,最小化可以很好地与Sl对象一起工作.并且我添加了它,因为我不希望每次移动对话框时都重新加载页面.

1)有人知道我每次按下最小化按钮时如何防止aspx页面的卸载/重新加载吗?

2)还是有人知道对话框上的每个mouseup事件之后将位置保存到代码隐藏的另一种方法(我将在每次保存新位置时更新数据库)?

似乎可以在Firefox中工作,但是在VS2010中进行即时调试时不能在IE中运行



The dialog contains silverlight objects that i pass vaiables to from the codebehind when the page first loads. everything works except when i minimize the dialog, then it seems to try and reload the silverlight object again but now the variables is missing and it wont work.

The minimize worked fine with the Sl objects when i didn''t use the Ajax script on the page. and i added it becouse i didn''t want the page to reload every time the dialog was moved.

1) Does anyone know how i can prevent the aspx page from unload/reload every time i hit the minimize button?

2) or does anyone know of another way to save the position to codebehind after every mouseup event on the dialogs (i''m going to update the database every time a new position is saved)?

it seems to work in Firefox, but not in IE when im debugging in VS2010

Thanks!

(document).ready(function(){
(document).ready(function () {


(''.ui-dialog-titlebar' ').mouseup(function(){ var a =
(''.ui-dialog-titlebar'').mouseup(function () { var a =


(''this'').parent().children(''.ui-dialog-title'').html.valueOf; document.getElementById("HiddenField1").value =(page +; Left =" +
(''this'').parent().children(''.ui-dialog-title'').html.valueOf; document.getElementById("HiddenField1").value = (page + ";Left=" +