Ich möchte HTML-Textbox-Wert im Controller erhalten. Unten ist mein Code anzeigenGet HTML-Steuerelemente Wert in Controller
@using (Html.BeginForm("SaveValues", "TestGrid",FormMethod.Post))
{
<table>
<tr>
<td>Customer Name</td>
<td>
<input id="txtClientName" type="text" />
</td>
<td>Address</td>
<td>
<input id="txtAddress" type="text" /></td>
<td>
<input id="btnSubmit" type="submit" value="Submit" /></td>
</tr>
</table>}
Bitte überprüfen Sie unter meinem Controller-Code die Werte
[HttpPost]
public ActionResult SaveValues(FormCollection collection)
{
string name = collection.Get("txtClientName");
string address = collection.Get("txtAddress");
return View();
}
Ich erhalte Nullwerte
Sie haben mein Leben gerettet)) –