Hello Developers I have a doubt of knowledge turns out that it makes three dropdown that they requested to me and the thing is that I have to do that it sends the information by means of a button to the controller in MVC 2
here the aspx code
<div class="row">
<h2 style="font-size: 20px;">Seleccione Origen de Carga de Datos</h2>
<%using (Html.BeginForm("OrigenDatos", "Origen", FormMethod.Post))
{%>
<div class="col-lg-12 col-sm-12" style="margin-top: 15px;">
<div class="col-lg-4 col-xs-12" style="margin-top: 5px;">
<label for="DropDownList2">Seleccione Origen 1</label>
<div class="col-xs-12">
<select name="ctl00$MainContent$DropDownList1" id="MainContent_DropDownList1" class="salutation " style="height: 17px; width: 202px; display: none;">
<option value="1">SIGO</option>
<option value="2">MEDIDORES PROPIOS</option>
<option value="3">COORDINADOR</option>
</select>
</div>
</div>
<div class="col-lg-4 col-xs-12" style="margin-top: 5px;">
<label for="DropDownList2">Seleccione Origen 2</label>
<div class="col-xs-12">
<select name="ctl00$MainContent$DropDownList2" id="MainContent_DropDownList2" class="salutation " style="height: 17px; width: 202px; display: none;">
<option value="1">SIGO</option>
<option value="2">MEDIDORES PROPIOS</option>
<option value="3">COORDINADOR</option>
</select>
</div>
</div>
<div class="col-lg-4 col-xs-12" style="margin-top: 5px;">
<label for="DropDownList2">Seleccione Origen 3</label>
<div class="col-xs-12">
<select name="ctl00$MainContent$DropDownList3" id="MainContent_DropDownList3" class="salutation " style="height: 17px; width: 202px; display: none;">
<option value="1">SIGO</option>
<option value="2">MEDIDORES PROPIOS</option>
<option value="3">COORDINADOR</option>
</select>
</div>
</div>
<input type="submit" value="Enviar" class="btn btn-primary" style="margin-top: 1px;">
<%} %>
</div>
</form>
</div>
</div>
We know how to receive this info and save it in different objects (According to its origin = origin 1, origin 2, origin 3)
I'm trying to do it like that but I do not enter the controller
public class OrigenController : Controller
{
// GET: Origen
public ActionResult Origen()
{
return View("~/Views/Origen/Origen.aspx");
}
[HttpPost]
public ActionResult OrigenDatos(string MainContent_DropDownList1, string MainContent_DropDownList2, string MainContent_DropDownList3)
{
var origen1 = MainContent_DropDownList1;
var origen2 = MainContent_DropDownList2;
var origen3 = MainContent_DropDownList3;
return View("~/Views/Origen/Origen.aspx");
}
}
What am I doing wrong?
Reply is welcome.