0
從http://msdn.microsoft.com/en-us/library/f5db6z8k(v=vs.100).aspx無法將「數據註解」到「布爾」
我創建了一個頁面customeValidators.cs,如果輸入的數據存在於Db爲檢查。 這有效。然而,當我嘗試從必要pagewith
protected void runUniqueReference(object source, ServerValidateEventArgs args)
{
args.IsValid = (CustomValidators.UniqueReference(BOQRefTextBox.Text));
}
我得到CustomValidators.UniqueReference
錯誤調用該方法,不能將「數據註解」到「布爾」 什麼想法? 編輯;
public static ValidationResult UniqueReference(string Reference)
{
ContextDB db = new ContextDB();
var lisStoredInDB =
(from Bill in db.Bill_Of_Quantities
where Bill.Reference == Reference
select Bill.Reference).ToList();
if (lisStoredInDB.Count != 0)
{
return new ValidationResult(string.Format("This reference is already stored in the database, Please enter another"));
}
return ValidationResult.Success;
}
什麼CustomValidators.UniqueReference的返回類型(字符串)? –
什麼是'UniqueReference'及其返回類型?在CustomValidators類中沒有稱爲UniqueReference的方法。 –
請參閱編輯 – John