如何解决Asp.Net MVC |下拉列表数据提取
如何将相关的sql数据拉到下拉列表中进行控制?下拉列表应默认为“m.alici”数据。
project(proj1)
add_library(proj1 src.cpp)
# This are private include files,whoever uses this library does not need them
target_include_directories(proj1 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
# These are public,needed both by this target and by whoever uses it.
target_include_directories(proj1 PUBLIC
# This is used when building the target
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/public/include>
# This is used when the target is installed
$<INSTALL_INTERFACE:include>)
# Instead of asking directly for a language standard we ask for a compiler feature. We make this public so whoever depends on this target knows they also need this feature.
target_compile_features(proj1 PUBLIC cxx_strong_enums)
# As above,but this is needed only by this target during the build.
target_compile_features(proe1 PRIVATE cxx_lambdas)
# Add an alias,users can use target_link_libraries(target PRIVATE|PUBLIC proj::proj1) to add this target as a dependency (this will propagate all the PUBLIC include paths,compile options,compile features,dependencies,etc.
add_library(proj::proj1 ALIAS proj1)
解决方法
在您的控制器中创建一个 ViewBag。注意最后一个参数可以加上默认值。
ViewBag.Example = new SelectList((from s in _cs.example.OrderBy(s => s.Code)
select new { ID = s.Id,FullDescription = s.Code + " - " + s.Description }),"ID","FullDescription","m.alici");
然后在你看来
@Html.DropDownListFor(m => m.Durum,(SelectList)ViewBag.Example,new { @class = "form-control" })
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。