Convert GridView.DataSource with DateTime column to datatable
I'm trying eventually to sort the gridview, But when I convert:
DataTable dt = (DataTable)gridAllTests.DataSource;
There's an exeption - can't convert object DateTime to String.
gridAllTests.DataSource = from test in db.Tests
select new
{
testId= test.TestId,
courseName = test.Course.Name,
onDate = test.OnDate,
lastRegisterDate =
test.LastRegisterDate
};
No comments:
Post a Comment