将url.action作为json对象返回mvc(return url.action as json object mvc)
我的Controller方法返回Json对象,其中url的形成如下所示:
return Json(new { url = Url.Action("ShowContact", "Customer", new { vm = contactVM }) }, JsonRequestBehavior.AllowGet);
在ajax调用的成功代码中,我想将此url分配给window.location.href,以便我可以根据url形成重定向到视图。 但是ajax调用的返回值显示作为url的一部分传递的路由值的纯文本值。
因此,我没有得到任何我希望传递给我的控制器的重定向操作方法的路由值。
那么我有什么选择来传递我的路由值,这是一个复杂的c#对象,包括集合? 有没有更好的方法来实现我想做的事情?
谢谢,
My Controller method returns Json object which has url formed as shown below :
return Json(new { url = Url.Action("ShowContact", "Customer", new { vm = contactVM }) }, JsonRequestBehavior.AllowGet);
In the ajax call's success code, I want to assign this url to window.location.href so I can redirect to view as per url formed. But return value of ajax call shows plain text value for route value passed as part of url.
Hence, I'm not getting whatever route value I want to pass to the redirect action method of my controller.
So what are the options I have in order to pass my route value which is complex c# object including collections? Is there any better approach to achieve what I want to do?
Thanks,
原文:https://stackoverflow.com/questions/30217361
满意答案
这取决于您对XAML / WPF的未来计划。 如果你想要启动并运行并尽可能快地使用它,你可以考虑同时从XAML和WPF开始(但请注意,你不能学习或使用WPF只是学习XAML)。
如果你计划长时间使用XAML / WPF并且你将面临很多WPF项目,你可能应该考虑从“纯”WPF开始。
我属于后一阵营,它首先了解WPF对象模型,渲染和布局系统,然后从XAML,样式,模板等开始,帮助我很多。对我而言,它使思考更容易理解(并且有一个很多东西要理解)。 我知道XAML只是表示/序列化.NET对象图形的另一种方式,该对象图形构建在顶层。 这也是Charles Petzold的书的结构,我认为当你想要真正了解WPF时,它是一本完美的书。
It depends on what your future plans are with XAML/WPF. If you want to get up and running and use it as quick as possible you might consider starting with XAML and WPF at the same time (but note that you can't learn or use WPF just be learning about XAML).
If you plan to work with XAML/WPF for a long time and you will have a lot of WPF projects ahead you probably should consider starting with "pure" WPF.
I belong to the latter camp and it helped me a lot to first get to know the WPF object model, rendering and layout system and then start with XAML, styles, templates etc. For me it made thinks easier to understand (and there is a lot to understand). I understood that XAML is just another way to represent/serialize a .NET object graph that is built as a layer on top. This is also the way Charles Petzold's book is structured and I think it is the perfect book to start with when you want to get to know WPF really well.
相关问答
更多没有XAML的WPF(WPF without XAML)
WPF:XAML Parse Exception未处理(WPF: XAML Parse Exception was unhandled)
Wpf xaml继承(Wpf xaml inheritance)
WPF图像与XAML(WPF Images vs. XAML)
XAML WPF验证(XAML WPF Validation)
WPF是否需要学习XAML(Is WPF required to learn XAML)
WPF应用程序是否需要使用XAML?(Do WPF application require the use of XAML?)
WPF / XAML代码生成器(WPF/XAML code generators)
Xaml不是WPF(Xaml not WPF)
WPF和XAML问题(WPF & XAML problem)
相关文章
更多Spring MVC 3 深入总结
请教关于spring mvc中使用json-lib-ext-spring返回json的问题
jquery ajax方法url请求action没有返回json数据。
有关MVC的问题
JSON是什么?
第二章 Spring MVC入门 —— 跟开涛学SpringMVC
asp.net mvc 微信开发随笔(1)
Json.Net学习笔记
net.sf.json解析json对象
javascript 对象转换成json格式数据(使用JSON.stringify)
最新问答
更多sp_updatestats是否导致SQL Server 2005中无法访问表?(Does sp_updatestats cause tables to be inaccessible in SQL Server 2005?)
如何创建一个可以与持续运行的服务交互的CLI,类似于MySQL的shell?(How to create a CLI that can interact with a continuously running service, similar to MySQL's shell?)
AESGCM解密失败的MAC(AESGCM decryption failing with MAC)
Zurb Foundation 4 - 嵌套网格对齐问题(Zurb Foundation 4 - Nested grid alignment issues)
湖北京山哪里有修平板计算机的
SimplePie问题(SimplePie Problem)
在不同的任务中,我们可以同时使用多少“上下文”?(How many 'context' we can use at a time simultaneously in different tasks?)
HTML / Javascript:从子目录启用文件夹访问(HTML/Javascript: Enabling folder access from a subdirectory)
为什么我会收到链接错误?(Why do I get a linker error?)
如何正确定义析构函数(How to properly define destructor)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!