从View中的View中读取Control DropDownList

时间:2013-09-09 19:56:52

标签: c# .net asp.net-mvc kendo-ui

VS '12 asp.net C#mvc Internet App + Kendo UI,EF Code First,Kendo UI

使用Kendo DDL

 @(Html.Kendo().DropDownList()
          .Name("dropdownlist")
          .BindTo(new string[] { "Leasehold A", "Mineral Owner", "Prospect", "StrangerInTitleNote", "StrangerInTitleNoteInfo", "StrangerLeasingNote", "StrangerLeasingNoteInfo", "Subject To", "Surface Note", "Surface Note Info", "Unreleased Mortage", "Unreleased Oil and Gas Leasors", "Vesting Note" })
          )

很简单吧? - 现在我想提取所选项目并将其放入Actionlink

@Html.ActionLink("Create New", "Create", new { id =  } )', null) ....

我在id=点放置什么?我怎样才能让它发挥作用。谢谢你的回答。 PS:到目前为止,对于大量或任何HTML不熟悉MVC,我必须使用脚本吗? - 我最好不要离开这个观点。

1 个答案:

答案 0 :(得分:2)

我是这样做的。可能不是最好的,但它对我有用。

这是链接:

@Html.ActionLink("Click Me", "YourAction", new { controller = "YourController"}, new       {id="YourActionLinkName"})

.click功能

$('#YourActionLinkName').click(function (e) {


            var val = $("#dropdownlist").val();
            var href = "/YourApp/YourController/YourAction/" + val;
            this.href = ""; //clears out old href for reuse
            this.href = href; //changes href value to currently slected dropdown value

        });