JQuery Mobile ajaxEnabled + asp.net 表单 postbackurl = issues

发布于 2025-01-06 15:42:31 字数 395 浏览 5 评论 0原文

我在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

桃扇骨 2025-01-13 15:42:31

尝试查看 jQuery 的 .live() 函数。 http://api.jquery.com/live/

try looking at jQuerys .live() function. http://api.jquery.com/live/

盛夏尉蓝 2025-01-13 15:42:31

尝试将表单标签(打开和关闭)放置在内容 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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文