I have some problem to Figure out how to use LINQ to SQL in .ashx file to generate json?
I am able to generate json using this code but I need to select TaskName and createdOn columns. can someone help me how to select TaskName and createdOn columns to generate json?
//DataClasses1DataContext db = new DataClasses1DataContext();
//var tasksCreatedOm = from c in db.Tasks
// select c.createdOn;
//the bloack will get all data in table
context.Response.ContentType = "text/json";
context.Response.Write(new SchedulerAjaxData(new DataClasses1DataContext().Tasks));
My Tasks Class

Try something like the following (untested):
First I projected your Tasks into an anonymous type containing
taskNameandcreatedOn. Then I used theJavaScriptSerializerto serialize them to JSON. I also added ausingblock so that theDataContextis disposed of properly.