How can i store data from a form created in mvc razor view without a model class and entity framework , I have wrote a simple method but as in razor view i have
@Html.TextBox("txtPrice", null, new { @class = "form-control valid", @data_val = "true", @data_val_required = "Property Price is required" })
How to get this textbox value in my c# code either i have to use Query String or what else is the technique i am good with web forms and i web forms we have runat="Server" attribute to access the text box but in razor i do not know how to achieve this.

Salman BegRank #284 · 8.8K reputationPosted Dec 18, 2016, 12:51 AM EST
Mark TaborRank #914 · 2.3K reputationPosted Dec 18, 2016, 1:09 AM EST
Mark TaborRank #914 · 2.3K reputationPosted Dec 18, 2016, 1:44 AM EST
Manas MohapatraRank #182 · 13.2K reputationPosted Dec 18, 2016, 4:32 AM EST
Mark TaborRank #914 · 2.3K reputationPosted Dec 18, 2016, 6:38 AM EST
Manas MohapatraRank #182 · 13.2K reputationPosted Dec 18, 2016, 9:02 AM EST
Mangesh GRank #294 · 8.6K reputationPosted Dec 18, 2016, 12:00 PM EST
Mark TaborRank #914 · 2.3K reputationPosted Dec 18, 2016, 9:53 PM EST
Mark TaborRank #914 · 2.3K reputationPosted Dec 19, 2016, 12:21 AM EST
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.Requested URL: /Property/SaveRecords
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Salman BegRank #284 · 8.8K reputationPosted Dec 19, 2016, 12:24 AM EST
Mark TaborRank #914 · 2.3K reputationPosted Dec 19, 2016, 12:33 AM EST
Mangesh GRank #294 · 8.6K reputationPosted Dec 19, 2016, 3:13 AM EST
public ActionResult Create(FormCollection collection)
{
try
{
if (collection != null)
{
string userName = collection["txtdetails"].ToString();
}
// TODO: Add insert logic here
return View();
}
catch(Exception ex)
{
return View();
}
}
ViewBag.Title = "Create";
}
Create
@using (Html.BeginForm("Create", "Sample"))
{
@Html.TextBox("txtid","111");
}
Manas MohapatraRank #182 · 13.2K reputationPosted Dec 19, 2016, 3:36 AM EST
MayankRank #4,018 · 371 reputationPosted Dec 22, 2016, 12:43 AM EST
public ActionResult Index(string txtPrice)
{
return View();
}