K
K
kek1232017-08-08 17:31:18
ASP.NET
kek123, 2017-08-08 17:31:18

How to connect selected DropDownList value to @Url.Action?

Added control to the view

@{
                    var listItems = new List<ListItem>
                    {
                            new ListItem  { Text = "item1", Value="item1" },
                            new ListItem  { Text = "item2", Value="item2" },
                            new ListItem  { Text = "item3", Value="item3" }
                    };
                }
@Html.DropDownList("ddlist", new SelectList(listItems, "Value", "Text"))

there is already something like this
<a target="_blank" href="@Url.Action("Download", new { t = ViewData["Token"] })" class="rn-button rn-button-sm rn-button_white">
                    <i class="rn-icon rn-icon-download"></i>
                    <span class="rn-button__text">Скачать</span>
                </a>

Those. a button that downloads a certain document.
How can I augment this Action so that it passes not only the Token, but also the value of the DropDownList?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fat Lorrie, 2017-08-08
@Free_ze

HTML forms , or using js to change the GET request parameters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question