public CarrotWebDataTable(HtmlHelper htmlHelper, PagedDataTable dp) { base.StandardInit(htmlHelper, dp); this.AutoGenerateColumns = false; this.AutoSort = true; this.HtmlClientId = "tblDataTable"; this.DataPage = dp; base.PagedDataBase = this.DataPage; }
public CarrotWebDataTable(HtmlHelper htmlHelper, PagedDataTable dp) { base.StandardInit(htmlHelper, dp); this.AutoGenerateColumns = false; this.AutoSort = true; this.HtmlClientId = "tblDataTable"; this.DataPage = dp; base.PagedDataBase = this.DataPage; }
public static CarrotWebDataTable CarrotWebDataTable(PagedDataTable dp) { return(new CarrotWebDataTable(Html, dp)); }
public ActionResult ProductDataSet(PagedDataTable model) { model.ToggleSort(); var srt = model.ParseSort(); string queryText = "SELECT Count(*) RowCt FROM [dbo].[Products] " + " \r\n" + "SELECT ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued \r\n" + "FROM (SELECT *, " + " (ROW_NUMBER() " + " OVER ( ORDER BY " + " CASE when @srtDir = 'ASC' AND @srt = 'ProductID' THEN ProductID END ASC, " + " CASE when @srtDir = 'ASC' AND @srt = 'ProductName' THEN ProductName END ASC, " + " CASE when @srtDir = 'ASC' AND @srt = 'SupplierID' THEN SupplierID END ASC, " + " CASE when @srtDir = 'ASC' AND @srt = 'CategoryID' THEN CategoryID END ASC, " + " CASE when @srtDir = 'ASC' AND @srt = 'QuantityPerUnit' THEN QuantityPerUnit END ASC, " + " CASE when @srtDir = 'ASC' AND @srt = 'UnitPrice' THEN UnitPrice END ASC, " + " CASE when @srtDir = 'ASC' AND @srt = 'UnitsInStock' THEN UnitsInStock END ASC, " + " CASE when @srtDir = 'ASC' AND @srt = 'UnitsOnOrder' THEN UnitsOnOrder END ASC, " + " CASE when @srtDir = 'ASC' AND @srt = 'ReorderLevel' THEN ReorderLevel END ASC, " + " CASE when @srtDir = 'ASC' AND @srt = 'Discontinued' THEN Discontinued END ASC, " + " CASE when @srtDir = 'DESC' AND @srt = 'ProductID' THEN ProductID END DESC, " + " CASE when @srtDir = 'DESC' AND @srt = 'ProductID' THEN ProductID END DESC, " + " CASE when @srtDir = 'DESC' AND @srt = 'ProductName' THEN ProductName END DESC, " + " CASE when @srtDir = 'DESC' AND @srt = 'SupplierID' THEN SupplierID END DESC, " + " CASE when @srtDir = 'DESC' AND @srt = 'CategoryID' THEN CategoryID END DESC, " + " CASE when @srtDir = 'DESC' AND @srt = 'QuantityPerUnit' THEN QuantityPerUnit END DESC, " + " CASE when @srtDir = 'DESC' AND @srt = 'UnitPrice' THEN UnitPrice END DESC, " + " CASE when @srtDir = 'DESC' AND @srt = 'UnitsInStock' THEN UnitsInStock END DESC, " + " CASE when @srtDir = 'DESC' AND @srt = 'UnitsOnOrder' THEN UnitsOnOrder END DESC, " + " CASE when @srtDir = 'DESC' AND @srt = 'ReorderLevel' THEN ReorderLevel END DESC, " + " CASE when @srtDir = 'DESC' AND @srt = 'Discontinued' THEN Discontinued END DESC " + " )) as RowID \r\n" + "FROM [dbo].[Products] ) as tbl \r\n" + "WHERE RowID BETWEEN @startRow AND @endRow "; Dictionary<string, string> dict = new Dictionary<string, string>(); dict.Add("srt", srt.SortField); dict.Add("srtDir", srt.SortDirection); dict.Add("startRow", (1 + (model.PageNumberZeroIndex * model.PageSize)).ToString()); dict.Add("endRow", (model.PageNumber * model.PageSize).ToString()); List<SqlParameter> parms = BuildParms(dict); DataSet ds = ExecDataSet(queryText, parms); model.TotalRecords = Convert.ToInt32(ds.Tables[0].Rows[0]["RowCt"]); model.SetData(ds.Tables[1]); ModelState.Clear(); return View(model); }
public ActionResult Products3(PagedDataTable model) { ViewBag.SupplierList = db.Suppliers.ToList(); return ProductDataSet(model); }
public ActionResult Products3() { PagedDataTable model = new PagedDataTable(); model.PageSize = 10; model.InitOrderBy("ProductName"); ViewBag.SupplierList = db.Suppliers.ToList(); return ProductDataSet(model); }
public ActionResult Products2(PagedDataTable model) { return ProductDataSet(model); }
public ActionResult Products2() { PagedDataTable model = new PagedDataTable(); model.PageSize = 10; model.InitOrderBy("ProductID"); return ProductDataSet(model); }