为什么我的Telerik ComboBoxFor不会绑定我的值并通过AJAX填充我的ComboBox?
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<div class="editor-field">
@Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
</div>
<div class="editor-field">
@(Html.Telerik().ComboBoxFor(model => model.VendorId)
.Name("ddlVendor")
.ClientEvents(events =>
{
events.OnLoad("onVendorLoad");
//events.OnChange("onVendorChange");
events.OnDataBinding("onComboBoxDataBinding");
}
)
.DataBinding(bind => bind.Ajax().Select("_AjaxGetVendors", "Car"))
)
</div>
<p>
<input type="submit" value="????????" />
</p>
</fieldset>}
Run Code Online (Sandbox Code Playgroud)
在我的控制器中,我获得了实体,但VendorId == 0.
[HttpPost]
public ActionResult Create(Car obj)
{
dm.InsertModel(obj);
return RedirectToAction("Create");
}
Run Code Online (Sandbox Code Playgroud) 我将db中的颜色保存在int值中.
int icolor = System.Drawing.Color.Red.ToArgb();
//result: -65536
Run Code Online (Sandbox Code Playgroud)
将int转换为Color而不是丢失属性Color.Name.必须返回"红色",但属性返回"ff000000".我在做什么?
我需要得到这个 - 属性红色但不是十六进制值
我有示例数据库,在我的asp.net项目中,我需要用另一个名称创建该数据库的副本.我正在考虑使用存储过程来完成它.
可能吗?如果是这样,怎么样?