|
 |
|
MVC EF Create ข้อมูล 2 ตาราง Employees กับ DrawMoney |
|
 |
|
|
 |
 |
|
Code (SQL)
select EMP_ID,
FirstName + ' '+LastName As _Name
from Employees
|
 |
 |
 |
 |
Date :
2018-09-14 14:42:24 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
//Create.cshtml codeนี้มีแต่ FirstName ให้เลือกครับ พอเลือก FirstName แล้ว ต้องการให้ LastName โชว์มาด้วยครับ
@model miniProMVC.Models.DrawMoneys
@{
ViewBag.Title = "Create";
}
<h2>Create</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>DrawMoneys</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.DrawDate, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DrawDate, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DrawDate, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.DrawAmount, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DrawAmount, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DrawAmount, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.EmployeeID, "EmployeeID", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DropDownList("EmployeeID", null, htmlAttributes: new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.EmployeeID, "", 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>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
|
 |
 |
 |
 |
Date :
2018-09-14 17:12:47 |
By :
KC9 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|