public frmWebClientQueryEditor(WebClientQuery wcq) { InitializeComponent(); wcqCopy = wcq; colNum = wcq.Columns.Count; SetFont(); InitializeQueryConditionItem(); }
public void SetQueryState(WebClientQuery qry, Panel pan) { UpdatePanel upan = this.GetModalUpdatePanel(2); if (upan != null && this.Page.Request.Form["__EVENTTARGET"] == upan.UniqueID) { //qry.Clear(pan); string script = string.Format("var behavior=$find('{0}behavior');if(behavior){{behavior.show();}}", this.QueryPanelID); ScriptManager.RegisterStartupScript(upan, this.GetType(), Guid.NewGuid().ToString(), script, true); } }
public void Query(WebClientQuery qry, Panel pan, UpdatePanel upan) { if (upan == null) upan = this.GetModalUpdatePanel(2); if (upan != null) { qry.Execute(pan); WebDataSource wds = this.GetObjByID(qry.DataSourceID) as WebDataSource; if (wds != null) { StringBuilder builder = new StringBuilder(); builder.AppendFormat("var behavior=$find('{0}behavior');", this.QueryPanelID); builder.Append("if(behavior){behavior.hide();}"); builder.AppendFormat("Ext.getCmp('{0}').setWhere('{1}');", this.ID, wds.WhereStr.Trim().Replace("'", "\\'")); ScriptManager.RegisterStartupScript(upan, this.GetType(), Guid.NewGuid().ToString(), builder.ToString(), true); } } }
//public WebClientQueryActionList() //{ //} public WebClientQueryActionList(IComponent component) : base(component) { wcq = component as WebClientQuery; }
private WebClientQuery CopyQueryFileds(int columncount, bool newpage) { WebClientQuery wcq = new WebClientQuery(); if (newpage) { wcq.ID = this.ID + "QueryTemp"; } else { object objQuery = this.GetObjByID(this.ID + "QueryTempPanel"); if (objQuery != null) { wcq = objQuery as WebClientQuery; return wcq; } wcq.ID = this.ID + "QueryTempPanel"; } if (this.QueryFields.Count > 0) { WebDataSource ds = null; object obj = null; if (this.ViewBindingObject != null && this.ViewBindingObject != "") { obj = this.GetObjByID(this.ViewBindingObject); } else if (this.BindingObject != null && this.BindingObject != "") { obj = this.GetObjByID(this.BindingObject); } if (obj != null) { String strDataSourceID = String.Empty; if (obj is CompositeDataBoundControl) { CompositeDataBoundControl dataControl = (CompositeDataBoundControl)obj; strDataSourceID = dataControl.DataSourceID; } else if (obj.GetType().Name == "ASPxGridView") { strDataSourceID = obj.GetType().GetProperty("DataSourceID").GetValue(obj, null).ToString(); } foreach (Control ctrl in this.Page.Form.Controls) { if (ctrl is WebDataSource && ((WebDataSource)ctrl).ID == strDataSourceID) { ds = (WebDataSource)ctrl; } } } if (ds == null) { throw new Exception("Can't find datasource of binding object"); } wcq.DataSourceID = ds.ID; wcq.GapVertical = 4; int columnindex = 0; int index = 0; string[] arrQueryText = null; if (this.ViewState["QueryTemp"] != null) { string strQueryText = this.ViewState["QueryTemp"].ToString(); arrQueryText = strQueryText.Split(';'); } wcq.KeepCondition = this.QueryKeepConditon; foreach (WebQueryField wqf in this.QueryFields) { WebQueryColumns wqc = new WebQueryColumns(wqf.Name, true, wqf.FieldName, wqf.Caption, 120, "ClientQuery" + wqf.Mode + "Column", "And", wqf.Condition, "Left"); wqc.DefaultValue = wqf.DefaultValue; wqc.IsNvarChar = wqf.IsNvarChar; if (columnindex == columncount) { wqc.NewLine = true; columnindex = 1; } else { wqc.NewLine = false; columnindex++; } if (arrQueryText != null) { wqc.Text = arrQueryText[index]; index++; } if (wqf.Condition == "") { Type tp = ds.InnerDataSet.Tables[ds.DataMember].Columns[wqf.FieldName].DataType; if (tp == typeof(string)) { wqc.Operator = "%"; } else { wqc.Operator = "="; } } if (wqf.Mode == "") { wqc.ColumnType = "ClientQueryTextBoxColumn"; } if (wqf.Mode == "RefVal" || wqf.Mode == "ComboBox") { wqc.WebRefVal = wqf.RefVal; } else if (wqf.Mode == "RefButton") { wqc.WebRefButton = wqf.RefVal; } wcq.Columns.Add(wqc); } } else { throw new Exception("No QueryFields in WebNavigator"); } this.Page.Form.Controls.Add(wcq); //为了使用Wcq的Page属性 return wcq; }