private void CreateItemsFromQuery() { queryItems.Clear(); if (base.Query.Length > 0) { string query = HttpUtility.UrlDecode(base.Query.Substring(1)); string[] items = query.Split('&'); foreach (string item in items) { if (item.Length > 0) { string[] namevalue = item.Split('='); if (namevalue.Length > 1) { queryItems.Add(namevalue[0], namevalue[1]); } else { queryItems.Add(namevalue[0], ""); } } } } }
/// <summary> /// Rebuilds the query item collection from its string representation. /// </summary> private void CreateItemsFromQuery() { _QueryItems.Clear(); if (base.Query.Length > 0) { string query = Uri.UnescapeDataString(base.Query.Substring(1)); string[] items = query.Split('&'); foreach (string item in items) { if (item.Length > 0) { string[] namevalue = item.Split('='); _QueryItems.Add(namevalue[0], namevalue.Length > 1 ? namevalue[1] : String.Empty); } } } }
/// <summary> /// Rebuilds the query item collection from its string representation. /// </summary> private void CreateItemsFromQuery() { _QueryItems.Clear(); if (base.Query.Length > 0) { // The Query component of the URI always begins with the ? separator, so get the entire string // after that, then split the string on the & separator, which is how each query item is delimited string query = base.Query.Substring(1); string[] items = query.Split('&'); foreach (string item in items) { if (item.Length > 0) { // Split the query item into a name/value pair, delimited by the first occurrence of =. Any // subsequent occurrences will be ignored despite being illegal as a non-URL encoded character string[] namevalue = item.Split(new char[] { '=' }, 2); // Add the name/value pair to the query item collection _QueryItems.Add(namevalue[0], namevalue.Length > 1 ? namevalue[1] : String.Empty); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { this.ReportID = Convert.ToInt32(base.Request["reportid"]); this.Options = QueryItemAction.QueryValidItems(this.ReportID); QueryItemCollection queryItemCollection = new QueryItemCollection(); for (int i = 0; i < this.Options.Rows.Count; i++) { queryItemCollection.Add(new QueryItem { ItemName = this.Options.Rows[i]["TermName"].ToString(), ItemSign = "", ItemValue = "", StrSql = this.Options.Rows[i]["StrSql"].ToString(), ToolTip = this.Options.Rows[i]["ToolTip"].ToString(), DataType = (int)this.Options.Rows[i]["DataType"], IsEmpty = (bool)this.Options.Rows[i]["IsEmpty"] }); } this.ItemList = queryItemCollection; this.dgdQuery_Bind(); } }