4
Goal: Retrieve view value for controller [Httppost]
I created a Generic class with gets and sets
public int ListarDadosCarteira_Resultado { get; set; }
public string ListarDadosCarteira_Descricao { get; set; }
public int ListarDadosCarteira_Total { get; set; }
Updating!! Loading View Complete use two model is only one as I took the second for testing.
@model Tuple<Generic>
@{
ViewBag.Title = "Index";}
<div class="painel">
<div class="painel-header">
<div class="painel-header-text-search">Carteira Mapa</div>
</div>
<div class="painel-content">
@using (Html.BeginForm())
{
<fieldset>
<legend>Index</legend>
@Html.TextBoxFor(model => model.Item1.ListarDadosCarteira_Total , new { @class = "newText" })
@Html.TextBoxFor(model => model.Item1.ListarDadosCarteira_Descricao , new { @class = "newText" })
@Html.TextBoxFor(model => model.Item1.ListarDadosCarteira_Resultado , new { @class = "newText" })
<div class="field-row">
<div class="editor-label">
<div class="posicao-botao">
<input type="submit" value="Pesquisar" class="button-search" title="Pesquisar Funcionario Fixa" />
</div>
</div>
</div>
</fieldset>
}
</div>
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
Now comes my doubt how I recover the entered value when I perform a [Httppost] ?
'Cause I usually bring it like this.
[HttpPost]
public ActionResult Index(Generic generica)
{
}
But if I do it this way it’s not bringing me values.
Post your complete View here
– Randrade
@Randrade Thank you for the first reply, I just updated as requested.
– Edgar Araujo
You don’t need to use the
Tuple
. You use the same when you need to pass more than oneModel
for the view, which is not your case. Your View name isIndex
also, correct? Only with theModel
, without theTuple
didn’t work?– Randrade