如何在下拉列表mvc3中表示数据表 [英] how to represent datatable in dropdownlist mvc3

查看:66
本文介绍了如何在下拉列表mvc3中表示数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

customerdata cd = new customerdata;
datatable dt = cd.FgetCustomertype();


fgetcustomertype()返回数据表以及如何在下拉列表中表示该数据表?

帮助帮助.


fgetcustomertype() returns the datatable and how to represent the datatable in dropdownlist?

Help help.

推荐答案

看看: ^ ]

http://stackoverflow.com/questions/1419887/dropdownlist-in-asp-net-mvc [^ ]
这可能会对您有所帮助.
have a look at :http://stackoverflow.com/questions/8549147/how-to-bind-datatable-to-html-dropdownlistfor-in-asp-net-mvc3[^]

http://stackoverflow.com/questions/1419887/dropdownlist-in-asp-net-mvc[^]
this might help you.


您好,
您可以使用ViewData对象将数据发送到页面.

控制器:
Hi,
You can use ViewData object to send the data to the page.

Controller:
ViewData["Table"]=dt;



查看:



View:

DataTable dt=ViewData["Table"];
ddlCountry.DataSource=dt;
ddlCountry.DataValueField="Code";
ddlCountry.DataTextField="Description";



-AK



-AK


这篇关于如何在下拉列表mvc3中表示数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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