Leer control DropDownList desde la vista dentro de la vista

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

Using 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" })
          )

Very simple right? - now i want to extract the selected Item and place it into an Actionlink

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

what do I place at the id= spot. How can I get this to work. Thanks for any answers. PS: Not familiar with MVC to much or any HTML so far, must I use a Script? - preferably I would like to not leave the view.

preguntado el 09 de septiembre de 13 a las 20:09

This will be impossible server-side; you don't have a selected item server-side. This value changes as the user makes changes. -

So ill have to have them click on a Submit, to a specific controller that does w/e i need it to do and return the view? -

Yes, but you were navigating away anyway, to another view, right? This appears to be a view to Para crear new records, which was likely a different interface yes? -

well kinda, its a ddl to an edit view so on click send me to this page but keep current one open cause it has images showing -

1 Respuestas

I do it like this. May not be the best but it works for me.

Aqui esta el link:

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

The .click function

$('#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

        });

Respondido el 09 de Septiembre de 13 a las 21:09

Very nice!! I am assuming not the best cause it captures every click? either way it works perfectly for me, thank you so much you saved me a CRAP TON OF PAIN +1 - Paquete

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.