I have mvc3 web application.
In that i have used EF and populate two dropdownlists from database.
Now when i select values from those dropdownlists i need to show them inside webgrid
how can i do this?
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Mapping</legend>
<div class="editor-label">
@Html.Label("Pricing SecurityID")
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.ID,
new SelectList(Model.ID, "Value", "Text"),
"-- Select category --"
)
@Html.ValidationMessageFor(model => model.ID)
</div>
<div class="editor-label">
@Html.Label("CUSIP ID")
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.ddlId,
new SelectList(Model.ddlId, "Value", "Text"),
"-- Select category --"
)
@Html.ValidationMessageFor(model => model.ddlId)
</div>
<p>
<input type="submit" value="Mapping" />
</p>
</fieldset>
}
when i clicked on Mapping button it will goes to new page called Mapping.cshtml and have to show webgrid with those two values.
I would create a ViewModel
}
and in my Get Action method, I will return this ViewModel to my strongly typed View
And In my View Which is strongly typed,
and now in my HttpPost Action method, I will accept this ViewModel as the parameter and i will have the Selected value there