I have the following dropdownlist, which shows the values 5,10 and 15:
<% Dim listItems = New List(Of ListItem) From { _
New ListItem() With { _
.Text = "5", _
.Value = 5 _
}, _
New ListItem() With { _
.Text = "10", _
.Value = 10 _
}, _
New ListItem() With { _
.Text = "15", _
.Value = 15 _
} _
}
%>
<%: Html.DropDownList("listado_noticia_length", New SelectList(listItems, "Value", "Text"), New With {Key .[class] = "form-control estilo_dropdownlist input-sm", Key .[onchange] = "javascript:registro_mostrar();"})%>
but I need to pass the selected value of the DropDownList (in this case its id would be list_news_length) to a parameter of this partial view, specifically to the row_count variable:
<%: Html.Action("partialListadoNoticia", "Noticias", New With {.pag = 1, .cant_filas = recibir el valor del dropdownlist listado_noticia_length ¿como?})%>
I don't know how I would send the value of the dropdownlist as a parameter to a variable of the partial view. Syntactically I don't know. I need to reference the value of dropdownlist, such as <%:Dim value_dropdownlist_selected= list_news_length.selectValue%>
That would be my question. Thanks in advance.
You will not be able to pass the value of the control because at the time you need it, it has not even been rendered, it is more when defining the
Html.Action()
code on the server side, the dropdownlist as a control does not exist yetWhat you could do is take the value of the list of items
as you will see using
listItems[0].Value
you do not leave the value fixed and you take it from the same source that generates the dropdownlist