2

我正在尝试过滤 BDC 列表,我的过滤器返回多个值。过滤 BDC 列表时,它会根据第一项进行过滤,然后忽略其余值。有没有人遇到过这个问题,你是如何解决的?

#region ITransformableFilterValues Members

        public bool AllowAllValue
        {
            get { return true; }
        }

        public bool AllowEmptyValue
        {
            get { return true; }
        }

        public bool AllowMultipleValues
        {
            get { return true; }
        }

        public string ParameterName
        {
            get { return "Ejemplo"; }
        }

        public ReadOnlyCollection<string> ParameterValues
        {

            get
            {

                List<string> regions = new List<string>();
                SPListItemCollection coleccion;
                using (SPSite site = new SPSite(SPContext.Current.Web.Url))
                {
                    using (SPWeb web = site.OpenWeb())
                    {                      
                        web.AllowUnsafeUpdates = true;
                        web.Update();
                        SPList list = web.Lists["Categorias"];
                        SPQuery query= new SPQuery();
                        query.Query= "<Where><Contains><FieldRef Name='Tags'/><Value Type='Note'>" +                HttpContext.Current.Request.Params.Get(0).ToString() + "</Value></Contains></Where>";

                        coleccion= list.GetItems(query);//this is the CAML query

                        debugger.Text = debugger.Text + "Items encontrados:" + coleccion.Count + "<br>" ;                                      
                        int i=0;                       
                        foreach (SPItem item in coleccion)//all the items i want i get them
                        {
                            try
                            {
                                regions.Add(item["Title"].ToString());
                                debugger.Text = debugger.Text + item["Title"].ToString() + "<br>";
                                i++;
                            }
                            catch (Exception ex)
                            {
                                debugger.Text = debugger.Text + item["Title"] + " Excepcion : values[" + i + "]" ;
                                i++;
                            }
                        }                                                         
                    }
                }
                ReadOnlyCollection<string> result = new ReadOnlyCollection<string>(regions);//i add the values to the collection to filter
                return result;

            }    
        }

        [ConnectionProvider("Filtro de ejemplos", "ITransformableFilterValues", AllowsMultipleConnections = true)]
        public ITransformableFilterValues SetConnection()
        {
            return this;
        }

    #endregion
4

0 回答 0