【发布时间】:2011-12-19 04:24:45
【问题描述】:
UpdateModel 失败,因为 arcm.Notes 进入此方法时为 null,我希望它为空字符串。
也许我需要在将 Notes 设置为 "" 后刷新 ValueProvider (?),这样我才能使用 UpdateModel。
public ActionResult Edit1(Guid id, ActivityResponseConsumerMobile arcm) {
if (arcm.Notes == null)
arcm.Notes = "";
if (!ModelState.IsValid) {
SetupDropDowns();
return View(arcm);
}
ActivityResponseConsumerMobile arcmDb = uow.ActivityResponseConsumerMobiles.Single(a => a.Id == id);
try {
UpdateModel(arcmDb, null, null, new[] { "Id" });
【问题讨论】: