asp.net AJAX的jQuery [英] asp.net ajax jquery

查看:86
本文介绍了asp.net AJAX的jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个加载的歌曲的播放列表的页面。在播放列表中的每首歌曲都能够围绕与jQuery播放列表被拖动。该网页还集成了服务器端与AJAX更新面板排序。问题是,之后我做了服务器端排序,jQuery的方法不工作了。

I have a page that loads a playlist of songs. The individual songs in the playlist are capable of being dragged around the playlist with jquery. The page also incorporates server side sorting with an ajax update panel. the problem is that after i do a server side sort, the jquery methods don't work anymore.

做jQuery方法得到重新附加到文档的asp.net阿贾克斯面板更新页面后?

do the jquery methods get re-attached to the document after the asp.net ajax panel updates the page?

推荐答案

有一个问题存在,如果我们使用的是updatepanel.So我们需要从服务器端每个页面加载。这可以这样做时添加的JavaScript将所有您的JavaScript codeS到一个字符串变量,它使用增加了 ScriptManager.RegisterStartupScript(这一点,this.GetType(),验证,剧本,FALSE); 请到<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerstartupscript.aspx/\" rel=\"nofollow\">http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerstartupscript.aspx/\"以获得有关函数及其参数的更多信息。

There is a problem exists if we are using an updatepanel.So we need to add the javascript from server side each time the page loads .this can be done by adding all your javascript codes in to a string variable and adds it using ScriptManager.RegisterStartupScript(this, this.GetType(), "validation", script, false); Please go to http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerstartupscript.aspx/" to get more information about the function and its arguments.

您可以让这样的功能

 private void addScript()
        {
            string script = @"<script type=""text/javascript"" language=""javascript"">
              javascript function including jquery
               </script>";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "validation", script, false);
        }

所有的JavaScript函数将字符串剧本中添加。
调用pageload.So功能将再次添加到页面。
我认为这将解决这个问题。

All the javascript function will be added in the string script. Call the function in pageload.So it will again adds to the page. I think this will solves the problem.

这篇关于asp.net AJAX的jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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