In my project i use kendo grid to show data and in my ActionResult i use this code to get data :
public ActionResult ShowData([DataSourceRequest] DataSourceRequest request, long studentid)
{
IQueryable<Models.Registration.RegistrationModel>
query =
from financeItem in db.RegistrationItems
select new Models.Registration.RegistrationModel
{
RegisterId = financeItem.RegistrationId,
Id = financeItem.Registration.Id,
Date = financeItem.Registration.Date,
StudentName = financeItem.Registration.Student.FirstName + " " + financeItem.Registration.Student.LastName
};
DataSourceResult dsr = query.ToDataSourceResult(request);
return Json(dsr, JsonRequestBehavior.AllowGet);
}
so . I need convert date to local date and I have a problem. this is my problem : when I want convert date inside query I get many error that linq2sql can't find converter function. so I change query type from IQueryable to list and try convert . but I get time out error because I've got a lot of records. after this error I try convert data inside get and set property in viewmodel like this code :
public string DateSs
{
get
{
return DateConvertor(Date.ToString());
}
set { value.ToString(); }
}
and I use this property inside view and show converted data. Everything works fine so far but when I want use filter part in kendo grid and filter data base on input date I get and error that this filed not exited in query. so I have a Headache and I don't know what must I do and how can I convert this dame date