JQuery Mobile ajaxEnabled + asp.net 表单 postbackurl = issues
我在使用 ASP.NET 制作的 jquery 移动网页时遇到问题。非访问第一页的页面上的回发不起作用,因为它们是使用 ajax 加载的 - 并且表单标记的“操作”不会更新。
我在表单标签上设置了 data-ajax="false" 。
我用 JS 更新了表单上的“action”属性,但是 asp.net 在回发中不接受该属性:“视图状态 MAC 验证失败”。 A 通过设置解决了这个错误 web.config 中的这个: 页面enableViewStateMac =“ false”enableEventValidation =“ false” 现在我可以毫无错误地回发到正确的页面。
但是,我正在回发的页面没有捕获回发。我看到表单数据已提交,但后面代码中的方法没有被触发。如果页面未加载 ajax,则工作正常。
I'm having troubles with a jquery mobile webpage made with asp.net. The postbacks on pages that are not the first page visited does not work, since they are loaded with ajax - and the "action" of the form tag is not updated.
I have set data-ajax="false" on the form tag.
I update the "action" attribute on the form with JS, but that is not accepted by asp.net in postbacks: "Validation of viewstate MAC failed". A made a workaround on this error by setting
this in web.config:
pages enableViewStateMac="false" enableEventValidation="false"
Now I can postback to correct page with no errors.
BUT, the page I'm postbacking on does not catch the postback. I see that the form data is submitted, but the method in code behind is not triggered. Works fine if the page is not ajax-loaded.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试查看 jQuery 的 .live() 函数。 http://api.jquery.com/live/
try looking at jQuerys .live() function. http://api.jquery.com/live/
尝试将表单标签(打开和关闭)放置在内容 div 之前和之后...然后您可以使用 data-ajax=true 并拥有精美的动画...
Try to place your form tags (open and close) just before and just after the content div... then you can use data-ajax=true and have the fancy animations...