【发布时间】:2017-06-06 07:47:47
【问题描述】:
有这个类:
public class ClientViewModel
{
public long PKID { get; set; }
[Required]
public string Name { get; set; }
public string Unit { get; set; }
public string StreetNumber { get; set; }
public string Street { get; set; }
public string Suburb { get; set; }
public string State { get; set; }
public string PostCode { get; set; }
public string Country { get; set; }
public string DT_RowId { get; set; }
public double Longitude { get; set; }
public double Latitude { get; set; }
public bool IsActive { get; set; }
}
剃刀视图的代码:
<form method="post" asp-controller="Clients" asp-action="Edit">
<input asp-for="PKID" type="hidden" />
<div class="portlet-body">
<div class="row">
<div class="form-group col-md-2">
<label asp-for="Name">Name:</label>
<input class="form-control input-sm" type="text" placeholder="Name" asp-for="Name">
<span class="help-block has-error" asp-validation-for="Name"></span>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="row physical-row default-row">
<div class="col-md-2">
<label class="control-label">Unit</label>
@Html.TextBoxFor(model => model.Unit, new {placeholder = "Unit", id = "physicalLocationUnit", @class = "form-control input-sm"})
</div>
<div class="col-md-4">
<label class="control-label">Street</label>
@Html.TextBoxFor(model => model.Street, new {placeholder = "PhysicalAddress", id = "physicalLocation", onfocus = "physicalinitialize()", @class = "form-control input-sm"})
</div>
<div class="col-md-2 postcode-box">
<label class="control-label">Post Code</label>
<div>
<input type="text"
tabindex="-1"
class="form-control input-sm" />
</div>
</div>
<div class="col-md-2 lattitude-box">
<label class="control-label" asp-for="Latitude">Latitude</label>
<div>
<input type="text"
tabindex="-1"
class="form-control input-sm" asp-for="Latitude" />
</div>
</div>
<div class="col-md-2 longitude-box">
<label class="control-label" asp-for="Longitude">Longitude</label>
<div>
<input type="text"
tabindex="-1"
class="form-control input-sm" asp-for="Longitude" />
</div>
</div>
</div>
</div>
<div class="form-actions">
<div class="col-md-offset-6 col-md-6">
<button type="submit" class="btn green">Save</button>
<a asp-controller="Clients" asp-action="WorkManage" asp-route-id="@Model.PKID" class="btn green">Add Work</a>
</div>
</div>
</div>
</div>
</form>
在经度和纬度中,例如 1.3 和 2.45 具有值,但是当我尝试调用控制器方法时,我在此变量中只有 0 值。我哪里错了?
干杯!
【问题讨论】:
-
当经度和纬度具有值时,例如
1,3和2,45它可以工作。但是当js验证器无法保存时,因为想看到1.3和2.45
标签: c# asp.net razor asp.net-core