如何在发布错误后在创建视图上填充子下拉列表 [英] how to fill sub drop down on create view after post error

查看:65
本文介绍了如何在发布错误后在创建视图上填充子下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





最近在mvc遇到问题,



i我在mvc工作crud适用于国家,州和城市。在创建城市视图时,我在创建操作中使用viewbag填充国家/地区下拉菜单,在选择国家时,我使用ajax填充州下拉列表。它运作良好。



问题是,当提交创建视图时,如果发生任何错误,那么我需要先前状态的视图意味着需要国家选择和状态应该如前所述。



我该怎么做?

Hi,

recently getting a problem in mvc,

i am working crud operation in mvc for country, state and city. On create view of city, i filled country dropdown with viewbag in create action and when selecting country i filled the state dropdown using ajax. it is working well.

the problem is that while submit create view, if any error will occur then i need the view in previous state means need country selected and state should be as previously selected.

how can i do this ?

推荐答案

这篇关于如何在发布错误后在创建视图上填充子下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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