使用json的级联下拉列表 [英] cascading dropdownlist using json

查看:268
本文介绍了使用json的级联下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究MVC,我想绑定级联下拉列表,例如country和state,因为我有级联下拉列表,我在我的Index操作中绑定了我的第一个country下拉列表,然后选择了国家在第一个下拉列表中我想绑定我的第二个下拉列表为州,但在行动方法国家下拉列表将成功出价,但对于州下拉列表我没有指定任何viewbag或viewdata,我有一个错误有没有用于具有状态键的selectlistitem的viewdata,



所以有必要为州下拉列表指定一个视图包,因为我使用json数据绑定我的状态下拉列表所以我不要不需要任何viewbag或viewdata。



谢谢

解决方案

查看这篇文章,非常好的



http://www.itorian.com/2013/02/cascading-dropdownlist-in-aspnet-mvc.html [ ^

I am working on MVC, I want to bind cascading dropdownlist, such like "country" and "state", since i have cascading dropdownlist i binds my first dropdownlist for "country" in my Index action and then on selection of "country" in first dropdownlist i want to bind my second dropdownlist for "state", but on action method "country" dropdown will be bid successfully but for state dropdownlist i does not specify any viewbag or viewdata, i have got an error "there is no viewdata for selectlistitem with state key",

so it is necessary to specify a viewbag for state dropdownlist, since i am binding my state dropdownlist using json data so i don't need any viewbag or viewdata.

Thanks

解决方案

Check this Article,really nice one

http://www.itorian.com/2013/02/cascading-dropdownlist-in-aspnet-mvc.html[^]


这篇关于使用json的级联下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆