void BindData() { List <DataControlInfo> result = DataControlHelper.GetDataControlsInfos(); if (ddlType.SelectedValue != "ALL") { result = result.FindAll(delegate(DataControlInfo dci) { return(dci.Group == ddlType.SelectedValue && (dci.Name.Contains(txtKeyWord.Text.Trim()) || dci.Desc.Contains(txtKeyWord.Text.Trim()))); }); } else { result = result.FindAll(delegate(DataControlInfo dci) { return(dci.Name.Contains(txtKeyWord.Text.Trim()) || dci.Desc.Contains(txtKeyWord.Text.Trim())); }); } PagedDataSource pds = new PagedDataSource(); pds.DataSource = result; pds.PageSize = Pager.PageSize; pds.AllowPaging = true; Pager.RecordCount = result.Count; pds.CurrentPageIndex = Pager.CurrentPageIndex - 1; if (pds.CurrentPageIndex < 0) { pds.CurrentPageIndex = 0; } ModeDataList.DataSource = pds; ModeDataList.DataBind(); }
protected void Sort(string sortName) { string sortText = sortName; List <DataControlInfo> ds = DataControlHelper.GetControls(sortName); ModeDataList.DataSource = ds; ModeDataList.DataBind(); if (ds.Count == 0) { ShowMessage("没有符合条件的控件。"); } else { ShowMessage(String.Format("总共 {0} 个控件。", ds.Count)); } }
protected override void Initialize() { string selectQuery = this.FieldDropDownList.SelectedItem.ToString(); string query = SearchTextBox.Text.Trim(); List <DataControlInfo> ds = DataControlHelper.GetControls(query, selectQuery); ModeDataList.DataSource = ds; ModeDataList.DataBind(); if (ds.Count == 0) { ShowMessage("没有符合条件的控件。"); } else { ShowMessage(String.Format("总共 {0} 个控件。", ds.Count)); } }
void BindData() { BaseControlHelper Helper = new BaseControlHelper(); List <DataControlInfo> infoList = Helper.GetDataControlsInfos(); List <DataControlInfo> result = new List <DataControlInfo>(); if (result != null) { if (ddlType.SelectedValue != "ALL") { foreach (DataControlInfo dci in infoList) { if (!result.Contains(dci) && dci.Group == ddlType.SelectedValue && (dci.Name.Contains(txtKeyWord.Text.Trim()) || dci.Desc.Contains(txtKeyWord.Text.Trim()) || dci.DefaultControl.Description.Contains(txtKeyWord.Text.Trim()))) { result.Add(dci); } } } else { foreach (DataControlInfo dci in infoList) { if (!result.Contains(dci) && (dci.Name.Contains(txtKeyWord.Text.Trim()) || dci.Desc.Contains(txtKeyWord.Text.Trim()))) { result.Add(dci); } } } PagedDataSource pds = new PagedDataSource(); pds.DataSource = result; pds.PageSize = Pager.PageSize; pds.AllowPaging = true; Pager.RecordCount = result.Count; pds.CurrentPageIndex = Pager.CurrentPageIndex - 1; if (pds.CurrentPageIndex < 0) { pds.CurrentPageIndex = 0; } ModeDataList.DataSource = pds; ModeDataList.DataBind(); } }
protected void Sort(string sortName) { string sortText = sortName; DataControl[] ds = TemplateHelper.SortDataControls(sortText); DetailGridView.DataSource = ds; DetailGridView.DataBind(); ModeDataList.DataSource = ds; ModeDataList.DataBind(); if (ds.Length == 0) { ShowMessage("没有符合条件的控件。"); } else { ShowMessage(String.Format("总共 {0} 个控件。", ds.Length)); } }
protected override void Initialize() { string selectQuery = this.FieldDropDownList.SelectedItem.ToString(); string query = SearchTextBox.Text; DataControl[] ds = TemplateHelper.GetDataControls(query, selectQuery); DetailGridView.DataSource = ds; DetailGridView.DataBind(); ModeDataList.DataSource = ds; ModeDataList.DataBind(); if (ds.Length == 0) { ShowMessage("没有符合条件的控件。"); } else { ShowMessage(String.Format("总共 {0} 个控件。", ds.Length)); } }