public ActionResult CSM_List(string searchKey, int?page, string itemNo) { WebView.WebService._base myWebService; myWebService = new WebService._base(); WebService._base.OSPCSM CSM = new WebService._base.OSPCSM(); if (searchKey != null) { CSM = myWebService.GetOSPCSM(0, 100000, searchKey, itemNo); ViewBag.searchKey = searchKey; ViewBag.itemNo2 = itemNo; } else { CSM = myWebService.GetOSPCSM(0, 100000, null, null); ViewBag.searchKey = ""; ViewBag.itemNo2 = "Select"; } ViewData["data7"] = CSM.CSMList; string input = "\\\\adsvr"; //string input = "\\\\server\\d$\\x\\y\\z\\AAA"; string output = String.Format("http:{0}", input.Replace("\\d$\\x\\y", String.Empty).Replace("\\", "/")); ViewBag.output = output; List <SelectListItem> list = new List <SelectListItem>(); using (Entities ctxData = new Entities()) { var queryItemNo = from p in ctxData.WV_CONTRACT_MAST select new { Text = p.ITEM_NO, Value = p.ITEM_NO }; list.Add(new SelectListItem() { Text = "", Value = "Select" }); foreach (var a in queryItemNo.Distinct().OrderBy(it => it.Value)) { if (a.Value != null) { list.Add(new SelectListItem() { Text = a.Text.ToString(), Value = a.Value.ToString() }); } } } ViewBag.itemNo = list; //return View(); int pageSize = 10; int pageNumber = (page ?? 1); return(View(CSM.CSMList.ToPagedList(pageNumber, pageSize))); }