0

私もthis answerに報告したように、MVC 4の "部分検証技術" を実装する必要があるでしょう:MVC 4:「部分検証」テクニックの使い方は?

 public class DontValidateEmailAttribute : ActionFilterAttribute 
     { public override void OnActionExecuting(ActionExecutingContext filterContext) 
       { 
        var modelState = filterContext.Controller.ViewData.ModelState;  
        var incomingValues = filterContext.Controller.ValueProvider;  
        var key = modelState.Keys.Single(x => incomingValues.Equals("Email")); 
        modelState[key].Errors.Clear(); 
        } 
      } 

しかし、私は、次のコンパイルエラー取得: "'System.Collections.Generic.ICollection<string>' does not contain a definition for 'Single' and no extension method 'Single' accepting a first argument of type 'System.Collections.Generic.ICollection<string>' could be found (are you missing a using directive or an assembly reference?)を..."

THX

+1

「System.Linqを使用しています」というメッセージが表示されていませんか? – gideon

+0

ありがとうございました!出来た。あなたが答えを出す場合、私は喜んで有効な回答としてマークします。 – Larry

答えて

1

あなたは上部にusing System.Linqがありませんか?

+0

それは働いた。ありがとうございました! – Larry

+0

:)あなたは大歓迎です! – gideon

関連する問題