i have this controller :
- public ActionResult search(int? page, string search , string KEYWORD_NAME)
- {
- if (search == null)
- {
- Bindkeyword();
- return View();
- }
- else
- {
- KEYWORD_NAME = Request.QueryString["Contant.KEYWORD_NAME"];
- Bindkeyword();
- DataSet dst = new DataSet();
- dst.Tables.Add(op.search(search, KEYWORD_NAME));
- List<ContantViewModel> seaech = new List<ContantViewModel>();
- foreach (DataRow dr in dst.Tables[0].Rows)
- {
- ContantViewModel u = new ContantViewModel();
- u.articalname = dr["ARTICAL_NAME"].ToString();
- u.articalbody = dr["ARTICALBODY"].ToString();
- u.userName = dr["IUSER"].ToString();
- u.articlid = dr["ARTICL_ID"].ToString();
- seaech.Add(u);
- }
- if (seaech.Count > 0)
- {
- op.addsearch(search, KEYWORD_NAME);
- return View(seaech.ToPagedList(page ?? 1, 10));
- }
- else
- {
- ContantViewModel u = new ContantViewModel();
- u.s = "there is no data ";
- u.s1 = "e.jpg";
- seaech.Add(u);
- return View(seaech.ToPagedList(page ?? 1, 10));
- }
- }
- }
and this is the view
i use this model :@model Wiki_Reach_Site.Models.ContantViewModel
i have error in the line in BOLD
this is the error
System.InvalidOperationException: The model item passed into the dictionary is of type 'PagedList.PagedList`1[Wiki_Reach_Site.Models.ContantViewModel]', but this dictionary requires a model item of type 'Wiki_Reach_Site.Models.ContantViewModel'.
how i can fix it ?