Need a good example of LinqDataSource in code, not markup?

This is an example of how to create a LinqDataSource and prepare it for use: LinqDataSource source = new LinqDataSource(); source. ContextTypeName = "MyDataContext"; source. TableName = "MyTable"; source.

Select = "new (Id As MyId, Name As MyName)"; source. Where = "Id > 1 To construct the query programatically instead, you can do this: LinqDataSource source = new LinqDataSource(); source. ContextTypeName = "MyDataContext"; source.

Selecting += source_Selecting; ... void source_Selecting(object sender, LinqDataSourceSelectEventArgs e) { e. Result = from number in numbers where number > 1 select number; }.

This is an example of how to create a LinqDataSource and prepare it for use: LinqDataSource source = new LinqDataSource(); source. ContextTypeName = "MyDataContext"; source. TableName = "MyTable"; source.

Select = "new (Id As MyId, Name As MyName)"; source. Where = "Id > 1"; To construct the query programatically instead, you can do this: LinqDataSource source = new LinqDataSource(); source. ContextTypeName = "MyDataContext"; source.

Selecting += source_Selecting; ... void source_Selecting(object sender, LinqDataSourceSelectEventArgs e) { e. Result = from number in numbers where number > 1 select number; }.

I was looking for a way to write a full linq query (not having to specify a TableName property, etc. ) I would consider just writing a linq query and using the result as the datasource for my control and binding to it, but I want to take advantage of the paging/sorting that LinqDataSource has. – Brian David Berman Feb 23 '09 at 21:04 I've added an example of a custom query. – bzlm Feb 24 '09 at 8:26.

This was made in relation SharePoint and the SPGridView but it might help you.

I don't need help writing the LINQ query. I just need help setting up the flow of the code. The reason I want to do it in code is because the complexity of the query I need goes beyond the capabilities of the LinqDataSource wizard.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions