在Jquery Server端调用asp.net [英] Call Jquery Server side asp.net
问题描述
嗨.我想使用此 http://www.erichynds.com/examples/jquery-notify/ [<我的asp.net应用程序上的一个href ="http://www.erichynds.com/examples/jquery-notify/" target ="_ blank" title ="New Window"> ^ ]插件.我正在使用javascriptserializer类在服务器端序列化标题和文本.而且我没问题显示它.但我的挑战是:我正在从数据库加载标题和通知内容.我没有负载和从数据库中选择的问题.我想在用户的每个页面加载时刷新通知.例如,将4行添加到数据库的通知表中.我如何才能序列化4个有价值的东西并将其绑定到JQUERY通知插件的Source和title属性,并向用户动态显示4个通知者?对于我想绑定到jquery属性插件的1个有价值的代码,我正在使用以下代码段:
Hi. i want to use this http://www.erichynds.com/examples/jquery-notify/[^]plugin on my asp.net application. I am serializing my title and text serverside with javascriptserializer class. and i have no problem to show it. but my challenge is : i am loading titles and Contents of notifies from database. i have no problem with load and selecting from Database. i want to refresh notifies on every page load for user. for example 4 row added to Notification Table on database. how can i serialize 4 valuable and binding it to Source and title property of JQUERY notification plugin and displaying 4 notifier to user dynamically ? for 1 valuable that i want to bind to a jquery property plugin i am using this code snippet:
JavaScriptSerializer serializer = new JavaScriptSerializer();
string jsArray = serializer.Serialize(my public Variable that is binded to Jquery plugin);
我以这种类型将对jQuery插件有价值的公共C#绑定:
i am binding public c# valuable to jquery plugin in this type :
title : <%=C# Variable%>
如何使用此方法向用户动态显示通知者?有没有更好的方法?我想在所有页面上显示通知.我是否要在Basepage上添加代码?英语不是我的第一语言.我的问题清楚了吗?谢谢,谢谢.
how can i use this method to displaying notifiers to user dynamically? is there any better method? i want to show notifies on all pages. have i to put codes on Basepage? English Is not my frist language . Does my question Clear? thanks all thanks all.
推荐答案
title应该是一个字符串,因此需要用引号引起来,并且C#变量的内容必须转义:
title should be a string, so it needs to be surrounded by quotes and the content of your C# variable needs to be escaped:
title: "<%=myString.Replace("\"", "\\\"")%>"
这篇关于在Jquery Server端调用asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!