20
Exception: The grid model doesn't contain a column named:
posted

Hi,

I am binding to a data source that is set in the GridDataSourceAction method as below -

List<Dictionary<string, string>> rows = new List<Dictionary<string, string>>();
            Dictionary<string, string> row = null;            

            foreach (DataRow dr in dataTable.Rows)
            {
                row = new Dictionary<string, string>();
                foreach (DataColumn col in dataTable.Columns)
                    row.Add(col.ColumnName, dr[col] == DBNull.Value ? string.Empty : dr[col].ToString());

                rows.Add(row);
            }

            
            return View(rows.AsQueryable());

I have set remote paging and remote filtering in my grid in javascript. The remote paging works successfully however the grid does not filter and the spinner keeps spinning. On closer inspection, i check the response and see that i am getting an error -

"Exception: The grid model doesn't contain a column named: KeyOfColumnImFiltering" 

I have checked the data source and can confirm i do the columns present.

Why would this be happening?

Thanks