, , ui,
GETTERS -
, , POST.
, -
public class MyModel1
{
public string name { get { return "Rami"; } }
public string email { get; set; }
}
-
public ActionResult Index()
{
MyModel1 m = new MyModel1();
m.email = "ramilu";
return View(m);
}
public ActionResult submit(MyModel1 m)
{
return null;
}
, -
@using (Html.BeginForm("submit", "New", FormMethod.Post))
{
@Html.LabelFor(model => model.email, new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.email)
@Html.ValidationMessageFor(model => model.email)
<input type="submit" value="Create" class="btn btn-default" />
}
"", , .

GETTERS SETTERS -
(, , - , cookie .. ). .
-
public class MyModel1
{
public string name { get; set; }
public string email { get; set; }
}
-
public ActionResult Index()
{
MyModel1 m = new MyModel1();
m.email = "ramilu";
m.email = "email";
return View(m);
}
public ActionResult submit(MyModel1 m)
{
return null;
}
-
@using (Html.BeginForm("submit", "New", FormMethod.Post))
{
@Html.LabelFor(model => model.email, new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.email)
@Html.ValidationMessageFor(model => model.email)
@Html.HiddenFor(model => model.name);
<input type="submit" value="Create" class="btn btn-default" />
}
, . -

, . ?
JQuery Unobstructive Validation .
ASP.Net MVC ( )