public ActionResult Grid1_PageIndexChanged(JArray Grid1_fields, int Grid1_pageIndex, int gridPageSize, string searchType, string searchMessage) { var grid1 = UIHelper.Grid("Grid1"); string sql = string.Empty; if (!searchType.Equals("")) { sql = sql + " and FMarkerType = '" + searchType + "'"; } if (!searchMessage.Equals("")) { sql = sql + " and FMsg like '%" + searchMessage + "%'"; } Hashtable table = Alarm_ParamDal.Search(Grid1_pageIndex, gridPageSize, "FMarkerType", "ASC", sql); var recordCount = Int32.Parse(table["total"].ToString()); // 1.设置总项数(数据库分页回发时,如果总记录数不变,可以不设置RecordCount) grid1.RecordCount(recordCount); grid1.PageSize(gridPageSize); // 2.获取当前分页数据 var dataSource = table["data"]; grid1.DataSource(dataSource, Grid1_fields); return(UIHelper.Result()); }
public ActionResult MyCustomPostBack(string type, JArray gridFields, JObject typeParams, int gridIndex, int gridPageSize) { var Grid1 = UIHelper.Grid("Grid1"); string sql = string.Empty; var ttbSearch = UIHelper.TwinTriggerBox("ttbSearchMessage"); if (type == "trigger1") { ttbSearch.Text(String.Empty); ttbSearch.ShowTrigger1(false); } else if (type == "trigger2") { ttbSearch.ShowTrigger1(true); var triggerValue = typeParams.Value <string>("triggerValue"); sql = " and FMsg like '%" + triggerValue + "%'"; } else if (type == "searchType") { var triggerValue = typeParams.Value <string>("searchType"); sql = sql + " and FMarkerType = '" + triggerValue + "'"; } Hashtable table = Alarm_ParamDal.Search(gridIndex, gridPageSize, "FMarkerType", "ASC", sql); Grid1.PageSize(gridPageSize); Grid1.DataSource(table["data"], gridFields); Grid1.RecordCount(Int32.Parse(table["total"].ToString())); return(UIHelper.Result()); }
public ActionResult Index() { Hashtable table = Alarm_ParamDal.Search(0, 1000, "FMarkerType", "ASC", " and FMarkerType = '1'"); ViewBag.Grid1DataSource = table["data"]; ViewBag.Grid1RecordCount = Int32.Parse(table["total"].ToString()); return(View()); }
public ActionResult btnSubmit_Click(JArray Grid1_fields, JArray Grid1_modifiedData, int Grid1_pageIndex, int gridPageSize, string searchType, string searchMessage) { Hashtable table = Alarm_ParamDal.Search(0, 1000, "FMarkerType", "ASC", ""); DataTable source = (DataTable)table["data"]; foreach (JObject modifiedRow in Grid1_modifiedData) { string status = modifiedRow.Value <string>("status"); string rowId = modifiedRow.Value <string>("id"); if (status == "modified") { UpdateDataRow(modifiedRow, Convert.ToInt32(rowId), source); } else if (status == "newadded") { DataRow rowData = CreateNewData(modifiedRow, source); source.Rows.Add(rowData); } else if (status == "deleted") { DeleteRowByID(source, Convert.ToInt32(rowId)); } } var grid1 = UIHelper.Grid("Grid1"); string sql = string.Empty; if (!searchType.Equals("")) { sql = sql + " and FMarkerType = '" + searchType + "'"; } if (!searchMessage.Equals("")) { sql = sql + " and FMsg like '%" + searchMessage + "%'"; } Hashtable table1 = Alarm_ParamDal.Search(Grid1_pageIndex, gridPageSize, "FMarkerType", "ASC", sql); var recordCount = Int32.Parse(table1["total"].ToString()); // 1.设置总项数(数据库分页回发时,如果总记录数不变,可以不设置RecordCount) grid1.RecordCount(recordCount); grid1.PageSize(gridPageSize); // 2.获取当前分页数据 var dataSource = table1["data"]; grid1.DataSource(dataSource, Grid1_fields); ShowNotify("数据保存成功!"); return(UIHelper.Result()); }