I want to assign EST_ID from index.cshtml to Create.cshtml view which uses Html.Editorfor(model=>model.EST_ID).

how to assign EST_ID to Html.Editorfor(model=>model.EST_ID) using tempdata or viewbag by getting EST_ID from table in index.cshtml?

Here's my controller code

public ActionResult Publication(int id)

{

if (ModelState.IsValid) {

string est = db.EstimateHeaders.Find(id).ToString();

ViewBag.EST_ID=est;

return RedirectToAction("Create", "EP");

}

return View();

}

Here's Create.cshtml code

@Html.EditorFor(model=>model.EST_ID, htmlAttributes : new {@placeholder="EST_ID", @class = "form-control", @readonly = "readonly", @required = "required" } )

How to assign EST_ID value from index.cshtml to create.cshtml editorfor?

Related posts

Recent Viewed