public ActionResult MyCustomPostBack(string type, JArray gridFields, JObject typeParams, int gridIndex, int gridPageSize, string FSchemeID) { 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 FName like '%" + triggerValue + "%'"; } sql = sql + " AND FSchemeID= " + Convert.ToInt32(FSchemeID); Hashtable table = AddressSchemeEntryDal.Search(gridIndex, gridPageSize, "id", "ASC", sql); Grid1.PageSize(gridPageSize); Grid1.DataSource(table["data"], gridFields); Grid1.RecordCount(Int32.Parse(table["total"].ToString())); return(UIHelper.Result()); }
public ActionResult Grid1_AfterEdit(JArray Grid1_fields, JArray Grid1_modifiedData, int Grid1_pageIndex, string FSchemeID, int gridPageSize, string searchMessage) { foreach (JObject modifiedRow in Grid1_modifiedData) { string status = modifiedRow.Value <string>("status"); int rowId = Convert.ToInt32(modifiedRow.Value <string>("id")); if (status == "modified") { Hashtable hasData = new Hashtable(); hasData["ID"] = rowId; Dictionary <string, object> rowDict = modifiedRow.Value <JObject>("values").ToObject <Dictionary <string, object> >(); if (rowDict.ContainsKey("FPLCAddress")) { hasData["FPLCAddress"] = rowDict["FPLCAddress"]; } if (rowDict.ContainsKey("FWorR")) { hasData["FWorR"] = rowDict["FWorR"]; } if (rowDict.ContainsKey("FUnit")) { hasData["FUnit"] = rowDict["FUnit"]; } if (rowDict.ContainsKey("FRate")) { hasData["FRate"] = rowDict["FRate"]; } if (rowDict.ContainsKey("FNote")) { hasData["FNote"] = rowDict["FNote"]; } AddressSchemeEntryDal.Update(hasData); } } var grid1 = UIHelper.Grid("Grid1"); string sql = string.Empty; if (!searchMessage.Equals("")) { sql = sql + " and FName like '%" + searchMessage + "%'"; } sql = sql + " AND FSchemeID= " + Convert.ToInt32(FSchemeID); Hashtable table = AddressSchemeEntryDal.Search(Grid1_pageIndex, gridPageSize, "id", "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 AddressSchemeEntry(string FSchemeID) { Hashtable table = AddressSchemeEntryDal.Search(0, 1000, "id", "ASC", " AND FSchemeID= " + Convert.ToInt32(FSchemeID)); ViewBag.Grid1DataSource = table["data"]; ViewBag.Grid1RecordCount = Int32.Parse(table["total"].ToString()); ViewBag.FSchemeID = FSchemeID; return(View()); }
public ActionResult Grid1_PageIndexChanged(JArray Grid1_fields, int Grid1_pageIndex, string FSchemeID, int gridPageSize, string searchMessage) { var grid1 = UIHelper.Grid("Grid1"); string sql = string.Empty; if (!searchMessage.Equals("")) { sql = sql + " and FName like '%" + searchMessage + "%'"; } sql = sql + " AND FSchemeID= " + Convert.ToInt32(FSchemeID); Hashtable table = AddressSchemeEntryDal.Search(Grid1_pageIndex, gridPageSize, "id", "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()); }