- "@Url.Action("NEWS_DETAILS", "Home", new { title=item.NEWS_TITLE })">
- @Html.Hidden("NewsID", item.NEWS_ID)
-
class="thumb" src="@item.SHOW_IMAGE" alt="">
- class="date">@item.NEWS_STARTDATE
-
@Html.Raw(@title)
- @Html.Markdown(@content + "....")
passing value razor to controller
hi everyone,
how can i passing razor to controller hidden value ? -->> @Html.Hidden("NewsID", item.NEWS_ID)

Bikesh SrivastavaPosted Dec 31, 2016, 3:50 AM
MayankPosted Dec 30, 2016, 6:28 AM
public ActionResult Index()
{
DataModel d = new DataModel();
d.LastName = "HiddenLast";
return View(d);
}
[HttpPost]
public ActionResult Index(DataModel model)
{
if (ModelState.IsValid)
{
model.Name = "new value";
ModelState.Clear();
return View(model);
}
return View(model);
}
Html:
@model ValidationsMvc.Models.DataModel
@{
ViewBag.Title = "Index";
}
Index
@using (Html.BeginForm("Index", "Home", FormMethod.Post))
{
@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.LastName)
@Html.EditorFor(model =>model.Name)
@Html.ValidationMessageFor(model => model.Name)
}
D DonthuPosted Dec 29, 2016, 2:07 AM
Ekrem TapanPosted Dec 29, 2016, 1:37 AM
Manas MohapatraPosted Dec 29, 2016, 1:19 AM
Ekrem TapanPosted Dec 29, 2016, 1:13 AM
Dilip GuptaPosted Dec 29, 2016, 1:13 AM
Dilip GuptaPosted Dec 29, 2016, 1:12 AM