 |
|
Code (C#)
public ActionResult Create()
{
var data = db.daily.OrderByDescending(d => d.ID).First();
return View(data);
}
Code (C#)
@model Accounting.daily
@{
ViewBag.Title = "Create";
}
<h2>Create</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>daily</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.detail, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.detail, new { htmlAttributes = new { @class = "form-control", @value = "" } })
@Html.ValidationMessageFor(model => model.detail, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.net_amount, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.net_amount, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.net_amount, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.amount, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.amount, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.amount, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.remain, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.remain, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.remain, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.flag, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
<div class="checkbox">
@Html.EditorFor(model => model.flag)
@Html.ValidationMessageFor(model => model.flag, "", new { @class = "text-danger" })
</div>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.use_date, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.use_date, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.use_date, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
ต้องการ Default value ที่ Field net_amount ครับแต่มันดันมาหมดทุก Field เลย
Tag : .NET, Web (ASP.NET), C#
|
|
 |
 |
 |
 |
Date :
2016-05-05 20:46:07 |
By :
kenghockey |
View :
1050 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |