//页面定义的参数 protected void Page_Load(object sender, EventArgs e) { try { //加入查询条件列表,设置默认值-----2013-11-6 V3.0 修改 //暂时只考虑二级联动,后期考虑多级的,反正要保证最后一级联动的最后赋值 this.AddOrUpdateQueryCondition(this.tbColumns_Name, null); this.AddOrUpdateQueryCondition(this.qc_MenuKey7Q, null); if (!this.IsPostBack) { //赋值定义的参数 //绑定枚举 //绑定引用字段下拉 //给两属性赋值 __ViewControlName = "SelectViewControl"; if (this.Request.Params["multiselect"] == "1") { SelectViewControl.SetMultiSelect(); } //设置按钮的权限隐藏 //空条件查询(相当于重置) btnQuery_Click(null, null); } } catch (Exception ex) { this.AjaxAlert(ex); } }
/// <summary> /// 查询绑定数据 /// </summary> public void LoadData() { //初始化时直接调用此方法,附上此值 if (thisGridParma.PageIndex != 0) { SelectViewControl.PagerSettings.PageIndex = thisGridParma.PageIndex; } thisGridParma.PageSize = SelectViewControl.PagerSettings.PageSize; var _T_Columns_Select_View_SelectViewControl = (this.Page as BasePage).ViewQueryHelper.GetViewControlQuery("T_Columns_Select_View_SelectViewControl"); _T_Columns_Select_View_SelectViewControl.PageSize = thisGridParma.PageSize; _T_Columns_Select_View_SelectViewControl.PageIndex = thisGridParma.PageIndex; if (!string.IsNullOrEmpty(thisGridParma.SortFieldName)) { _T_Columns_Select_View_SelectViewControl.OrderTableAlias = thisGridParma.SortFieldName.Split('$')[0]; _T_Columns_Select_View_SelectViewControl.OrderFieldName = thisGridParma.SortFieldName.Split('$')[1]; _T_Columns_Select_View_SelectViewControl.OrderMethod = thisGridParma.SortDirection == "asc"?Drision.Framework.LiteQueryDef.Internal.OrderMethod.ASC:Drision.Framework.LiteQueryDef.Internal.OrderMethod.DESC; } //赋条件,如果有条件或者是作为树形两种页面有树作为条件的,都要先定义 //2013-11-6 V3.0 修改 (this.Page as BasePage).SetQueryCondition_FromGridParmaToViewQuery(_T_Columns_Select_View_SelectViewControl, thisGridParma); //如果有树作为条件的,也要把树条件加进来 var _dataCount = 0; var result = QueryData(_T_Columns_Select_View_SelectViewControl, ref _dataCount); SelectViewControl.PagerSettings.DataCount = _dataCount; //如果当前页无数据,则跳到上一页重查,直到有数据或跳到了第一页就没办法了 while (result.Rows.Count == 0 && thisGridParma.PageIndex > 0) { thisGridParma.PageIndex--; _T_Columns_Select_View_SelectViewControl.PageIndex--; _T_Columns_Select_View_SelectViewControl.PageIndex--; result = QueryData(_T_Columns_Select_View_SelectViewControl, ref _dataCount); } SelectViewControl.DataSource = result; //以下为列统计 //添加格式化字符串 SelectViewControl.SetFormatString("MenuKey", _T_Columns_Select_View_SelectViewControl.ViewFieldFormatDict["MenuKey"]); SelectViewControl.SetFormatString("a$Columns_Name", _T_Columns_Select_View_SelectViewControl.ViewFieldFormatDict["a$Columns_Name"]); SelectViewControl.DataBind(); }
/// <summary> /// 查询 /// </summary> protected void btnQuery_Click(object sender, EventArgs e) { try { //2013-11-6 V3.0 修改 GridParma thisGridParma = GetNewGridParma(); AddGridParma(thisGridParma); //查询数据 SelectViewControl.InitData(); this.AjaxAlert(string.Empty, "EnableButton();"); } catch (Exception ex) { this.AjaxAlert(ex); } }