Hi,

im trying to export data that has been filtered using gridfilters. Seems like i cant retrieve the paramprefix to do the job. Heres my code below. Would appreciate if someone could help.

 protected void ExportToCsv(object sender, DirectEventArgs e)
        {
            List<HistoryExport> data = RandomBLL.ExportHistory(comboCentre.SelectedItem.Value, Request.QueryString["sid"]);

            string s = this.GridFilters1.ParamPrefix;

            if (!string.IsNullOrEmpty(s))
            {
                FilterConditions fc = new FilterConditions(s);

                foreach (FilterCondition condition in fc.Conditions)
                {
                    Comparison comparison = condition.Comparison;
                    string field = condition.Name;
                    FilterType type = condition.FilterType;

                    object value;
                    switch (condition.FilterType)
                    {
                        case FilterType.Boolean:
                            value = condition.ValueAsBoolean;
                            break;
                        case FilterType.Date:
                            value = condition.ValueAsDate;
                            break;
                        case FilterType.List:
                            value = condition.ValuesList;
                            break;
                        case FilterType.Numeric:
                            if (data.Count > 0 && data[0].GetType().GetProperty(field).PropertyType == typeof(int))
                            {
                                value = condition.ValueAsInt;
                            }
                            else
                            {
                                value = condition.ValueAsDouble;
                            }

                            break;
                        case FilterType.String:
                            value = condition.Value;
                            break;
                        default:
                            throw new ArgumentOutOfRangeException();
                    }

                    data.RemoveAll(
                        item =>
                        {
                            object oValue = item.GetType().GetProperty(field).GetValue(item, null);
                            IComparable cItem = oValue as IComparable;

                            switch (comparison)
                            {
                                case Comparison.Eq:

                                    switch (type)
                                    {
                                        case FilterType.List:
                                            return !(value as ReadOnlyCollection<string>).Contains(oValue.ToString());
                                        case FilterType.String:
                                            return !oValue.ToString().StartsWith(value.ToString());
                                        default:
                                            return !cItem.Equals(value);
                                    }

                                case Comparison.Gt:
                                    return cItem.CompareTo(value) < 1;
                                case Comparison.Lt:
                                    return cItem.CompareTo(value) > -1;
                                default:
                                    throw new ArgumentOutOfRangeException();
                            }
                        }
                    );
                }
            }

            string json = JSON.Serialize(data);
            StoreSubmitDataEventArgs eSubmit = new StoreSubmitDataEventArgs(json, null);
            XmlNode xml = eSubmit.Xml;

            this.Response.Clear();
            this.Response.ContentType = "application/octet-stream";
            this.Response.AddHeader("Content-Disposition", "attachment; filename=submittedData.csv");
            XslCompiledTransform xtCsv = new XslCompiledTransform();
            xtCsv.Load(Server.MapPath("~/export_template/Csv.xsl"));
            xtCsv.Transform(xml, null, this.Response.OutputStream);
            this.Response.End();
        }