This is a migrated thread and some comments may be shown as answers.

Problem with lowercase filter using NeedDataSource

2 Answers 148 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris Messineo
Top achievements
Rank 1
Chris Messineo asked on 27 Feb 2009, 02:05 PM
Hello all, I can't seem to get lowercase filtering to work.  I have a client table with last names as such 'Jones', 'Adams' ect

Filtering on that column in lowercase such as typing in 'jones' and using contains will not show in the grid even if I step through and see that I am returning a row of data.  Typing in 'Jones' and filtering that way works fine.  I think i am doing something wrong with my NeedDataSource event.

Here is my code ( i am using Custom paging):

        protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            int count = 0;

            RadGrid1.DataSource = ClientBLL.GetPagedClients(RadGrid1.PageSize, RadGrid1.MasterTableView.CurrentPageIndex * RadGrid1.PageSize, RadGrid1.MasterTableView.FilterExpression, currentsort.Value, out count);
            RadGrid1.MasterTableView.VirtualItemCount = count;
                          
        }


    
Here is the code for retrieving the data:

        public static IQueryable<APAPortal.vw_client> GetPagedClients(int maximumRows, int startRowIndex, string filterExpression, string sortExpression, out int count)
        {
            APADataContext db = new APADataContext();
            var query = from c in db.vw_clients
                        select c;

            //Set filter expresion
            if (!String.IsNullOrEmpty(filterExpression))
            {
                query = query.Where(String.Format(@"{0}", filterExpression));
            }

            if (!String.IsNullOrEmpty(sortExpression))
            {
                query = query.OrderBy(sortExpression);
            }
            else
            {
                query = query.OrderBy("RecordAccountName Asc");
            }

            //Set the total row count
            count = query.Count();

            var pagedData = query.Skip(startRowIndex).Take(maximumRows);

            return pagedData;
        }




2 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 03 Mar 2009, 11:21 AM
Hello Chris,

Can you please verify that you are using the latest version 2008.3.1314 of RadControls for ASP.NET AJAX in your project and that  you set GroupingSettings -> CaseSensitive = false? This should ensure that the filtering will be case-insensitive.

Another solution would be to set the EnableLinqExpression property of the control to false (in case you use the .NET 35 build of Telerik.Web.UI.dll) in case you do not plan to use internal LINQ expressions for sorting, paging, filtering, etc.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Chris Messineo
Top achievements
Rank 1
answered on 05 Mar 2009, 07:14 PM
Hi Sebastian,

Thanks, setting GroupingSettings -> CaseSensitive = false solved my issue.

FYI:

I am using 2008.3.1314 of RadGrid and I have EnableLinqExpression set to true.




Tags
Grid
Asked by
Chris Messineo
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Chris Messineo
Top achievements
Rank 1
Share this question
or