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

Why Does my Paging and sorting not working correctl

0 Answers 8 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Perry asked on 15 Feb 2018, 03:44 PM

I have a radgrid with these propertie



The radgrid works as expected.  I use this code in my needdatasource

string strYear = DateTime.Now.Year.ToString();
            DateTime StartDate = Convert.ToDateTime("1/1/" + strYear);
            DateTime EndDate = Convert.ToDateTime("12/31/" + strYear);
            rgData.DataSource = DbContext.tblData
                .Where(d => d.deleted == false).ToList();


sort and paging is working properly

Now I want to filter the data by a date range so I use this code

Boolean DateChk1 = dpStartDate.SelectedDate.HasValue;
            Boolean DateChk2 = dpStartDate.SelectedDate.HasValue;
            string comboSearch = cboxSearch.Text;
            int intComboSearch = comboSearch.Length;
            if (comboSearch.Length > 0 && DateChk1 == true && DateChk2 == true)
                DateTime Date1 = dpStartDate.SelectedDate.Value;
                DateTime Date2 = dpEndDate.SelectedDate.Value;
                rgData.DataSource = DbContext.AAADataSearchByDateRange(comboSearch, Date1, Date2).ToList();

The data refreshes and shows the filtered data.  Now if I click the column header to sort or I chnage to another page the radgrid looses all data and all I see is a line on the screen.  Can someone please explain the problem and how to fix it



No answers yet. Maybe you can help?

Asked by
Top achievements
Rank 1
Share this question