0

Is there anyway to make this work:

<select>
        <option>@Html.ActionLink("View", "View", "Person")</option>
        <option>@Html.ActionLink("Edit", "Edit", "Person")</option>
    </select>

So it's basically a dropdown full of links. When you click a link it should direct to the action method like a normal ActionLink helper.

tereško
  • 58,060
  • 25
  • 98
  • 150
AnonyMouse
  • 18,108
  • 26
  • 79
  • 131
  • Might want to look at this question... http://stackoverflow.com/questions/2000656/using-href-links-inside-option-tag – gwing33 Sep 06 '12 at 22:49

1 Answers1

0

You can handle the change event of the select to open the links, like this:

html:

<select>
    <option>@Url.Action("View", "View", "Person")</option>
    <option>@Url.Action("Edit", "Edit", "Edit")</option>
</select>

javascript:

$('select').change(function(){ window.href = $(this).find(':selected').text();});
mcorte
  • 42
  • 2