2014-02-18 4 views
0
[HttpGet] 
public ActionResult SearchByOperator(DateTime fromdate, DateTime todate, string operatorname,int page=1) 
{ 
    List<CRBT_CALLS> operator_list = new List<CRBT_CALLS>(); 
    using (crbt_onwebEntities dbcontext = new crbt_onwebEntities()) 

    operator_list = (from z in dbcontext.CRBT_CALLS 
        where z.DOWNLOAD_TIME > fromdate && z.DOWNLOAD_TIME < todate && z.OPERATOR == operatorname 
        select z).OrderBy(x => x.DOWNLOAD_TIME).ToList(); 

이것은 내보기 페이지입니다. 내가 1, 2, 3, 페이징 링크를 클릭하고 때 보여주고있다 : 당신은 적절한 매개 변수를 포함하지 않는 같은 오류 페이지를 기반으로mvc3에서 html 테이블로 페이징

The parameters dictionary contains a null entry for parameter 'fromdate' of non-nullable type 'System.DateTime' for method 'System.Web.Mvc.ActionResult SearchByOperator(System.DateTime, System.DateTime, System.String, Int32)' in 'mvclogin.Controllers.HomeController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. 
Parameter name: parameters 

답변

1

, 그것은 최대 페이징 링크의 액션에 보이는 . 오류 메시지에는 fromDate 매개 변수가 포함되어 있지 않으며 필수 매개 변수이며 경로와 일치하는 다른 조치가 없기 때문에 오류가 발생합니다.

페이징 링크의 쿼리 문자열에 모든 매개 변수 정보 (fromdate, todate 등)를 포함 시키거나이 매개 변수를 선택적으로 허용하도록 동작을 다시 정의해야합니다.