简体   繁体   English

如何从MVC4中的sql表绑定dropdownlist中的值?

[英]how to bind values in dropdownlist from sql table in MVC4?

I am currently working on matrimonial site registration page... I want to know how to take the values from sql database and bind it to dropdownlist on the registration page? 我目前正在婚姻网站注册页面上工作...我想知道如何从sql数据库中获取值并将其绑定到注册页面上的dropdownlist? How to bind values to dropdownlist from sql table in c# MVC4? 如何将值从C#MVC4中的SQL表绑定到dropdownlist?

Q: "how to take the values from sql database" 问: “如何从sql数据库中获取值”

A: You may use some ORM layer(EntityFramework, Linq2SQL, ...) or native SQL queries executed via SqlDataAdapter . 答:您可以使用一些ORM层(EntityFramework,Linq2SQL等)或通过SqlDataAdapter执行的本机SQL查询

Q: " how to bind values in dropdownlist from sql table in c# MVC4?" 问: “如何从c#MVC4中的sql表绑定dropdownlist中的值?”

A: Here is one possibile solution 答: 是一个可能的解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM