Here i am fetching the value from database and showing it in a input field
and
I'll just try to answer the question but my examples very simple because I'm new at mvc. Hope this help somebody.
[HttpPost] ///This function is in my controller class
public ActionResult Delete(string txtDelete)
{
int _id = Convert.ToInt32(txtDelete); // put your code
}
This code is in my controller's cshtml
> @using (Html.BeginForm("Delete", "LibraryManagement"))
{
@Html.Label("Enter an ID number");
@Html.TextBox("txtDelete") }
Just make sure the textbox name and your controller's function input are the same name and type(string).This way, your function get the textbox input.