为什么 Asp.net 部分视图不返回?
我是一个新手,刚刚开始学习 asp.net mvc,因为我正在学习部分视图教程,并且创建了一个运行良好的小型测试应用程序。
我有一个包含客户订单的页面,每个项目都有一个用于添加或删除项目的编辑按钮,通过按下它,我可以增加项目或从购物车中删除项目。对于我正在使用的此类操作,
HTML.actionlink("+", "AddToCart", "Orders", new { orderid=tempcart.orderid },
new AjaxOptions()
{
OnBegin = "showplaces",
OnSuccess = "hideloader"
}, null);
因此当我单击按钮时,它会转到 AddToCart() 操作并更新数据库中的表,但它不会更新部分视图,并且 loader.gif 永远保留在页面上并且不会调用hideloader() 函数。
你能告诉我有什么问题吗?
I am a newbie and just started learning the asp.net mvc, as I was going through the partial view tutorial and I created the small test application which is working fine.
I have a page which has a customers order and each item has an edit buttons for adding or deleting the items and by pressing it I can increase an item or delete an item from the cart. And for such action I am using
HTML.actionlink("+", "AddToCart", "Orders", new { orderid=tempcart.orderid },
new AjaxOptions()
{
OnBegin = "showplaces",
OnSuccess = "hideloader"
}, null);
so when I click the button it goes to AddToCart() action and update the table in database but it doesn't update the partial view and the loader.gif stays forever on the page and don't call the hideloader() function.
Can you please tell me what's the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1- 在更新部分视图时第一个用户 Ajax.ActionLink
2- 还需要放置购物车的 div id,以便在操作完成时可以更新它。
3-我曾经遇到过这样的问题,所以我做了以下操作:
在 Ht 中添加 OnFailure 属性
并使用此方法获取 DOM 异常:
希望这会有所帮助...
1- First user Ajax.ActionLink as you are updating the partial view
2- One thing also place the cart's div id so it can get updated when action finishes.
3- And I had such problem once, so I did the following:
add OnFailure attribute in Ht
and use this method to get DOM exception:
hope this helps ...