0
我而動1個項目,僅僅是數據層,該項目使用MVC 1.0和接取MDB:S實現IDataErrorInfo的亞音速2.2
現在我移動到亞音速+ SQL Server和所有的罰款,除非我嘗試實現我的類IDataErrorInfo驗證消息,我總是得到2次每個錯誤消息
我有一個由subsonic生成的表類:MyTable,然後我擴展它。
public partial class myTable : IDataErrorInfo{
public string this[string columnName]{
get{
switch (columnName.ToUpperInvariant()){
case "MYFIELD":
if (string.IsNullOrEmpty(myField)){
return "Incorrect MyField";
}
break;
case "ANOTHER":
if (string.IsNullOrEmpty(myField)){
return "Incorrect Another";
}
break;
}
return "";
}
}
public string Error{
get{
return "";
}
}
}
在我的控制器我添加到我的職務行爲驗證碼:
public class mycontroller...{
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult myAction(int id, MyTable data)
{
try
{
UpdateModel(data, new[] { "MyField","Another" });
data.Save();
return RedirectToAction("Admin");
}
catch (Exception ex)
{
//ViewData["Error"] = ex.Message;
return View(data);
}
}
我的看法是Html.ValidationSummary已生成的摘要( 「注意:」)
當我得到無效數據我的總結得到2倍的錯誤,因爲它:
注意:
錯誤MyField的
錯誤MyField的
不正確的另一個
不正確的另一個
我不想改寫驗證形式,這裏是一個很大的意見(約130)。我認爲問題是在亞音速的某個地方,但我不能得到的地方:S,請幫助我:)
最好的問候和感謝提前。
沒有辦法趕上V2.0.3這個錯誤:(您正在使用哪個版本的亞音速的
我從谷歌下載源代碼最新的亞音速2.2,就在5天前,並且編譯了它,在哪裏調用它2倍的驗證方法呢?我要去看看,謝謝 – 2009-06-22 03:38:51