如何在局部视图中使用MVC3 Razor绑定下拉列表 [英] How to Bind Dropdown using MVC3 Razor in partial view

查看:106
本文介绍了如何在局部视图中使用MVC3 Razor绑定下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,我在部分视图中有Dropdown(考虑我的主页)

Hi friends i have Dropdown in my partial View (Consider my home page)

@Html.DropDownListFor(model => model.name, new SelectList(new List<Object>{
                   new { value = "gg" , text = name1 },
                   new { value = "hh" , text = name2 },
                   new { value = "jj" , text = name3},
                   new { value = "kk" , text = name4 }
                 }, "value", "text"), new { id = "ddlClass", @class = "field04" })





i在我的其他视图中调用此局部视图进行渲染。

(考虑我的子页面)



因此,当我从下拉列表中的主页面中选择一个值时,我无法在同一部分视图的另一个视图中获得相同的值
我的主页中的
我在我的模型中设置了值虽然渲染时间不显示请帮助我................



i called this partial view in my other view to render.
(Consider my sub page)

So when i select a value from main home page in dropdown i cant get the same value in the other view for the same partial view
in my home page i have value setting in my model by while rendering time its not displaying please help me................

推荐答案

你的问题对我来说并不清楚。但你可以使用下面提到的链接来获取声音有关ASP.net MVC的下拉列表的知识。它显示了为下拉列表绑定数据的不同方式。检查。



将DropDownList Helper与ASP.NET MVC一起使用



我希望这会对你有所帮助。
Your problem is not clear for me.But you can use below mentioned link for get sound knowledge about the drop down list with ASP.net MVC. It shows varies way for bind the data for drop down list.Check that.

Using the DropDownList Helper with ASP.NET MVC

I hope this will help to you.


这篇关于如何在局部视图中使用MVC3 Razor绑定下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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