Skip to Content
Beginning ASP.NET 3.5: In C# and VB
book

Beginning ASP.NET 3.5: In C# and VB

by Imar Spaanjaars
March 2008
Intermediate to advanced content levelIntermediate to advanced
766 pages
21h 15m
English
Wrox
Content preview from Beginning ASP.NET 3.5: In C# and VB

13.4. Using Server Controls with LINQ Queries

So far you have seen one way to bind the results of a LINQ query to a control in your ASPX page: assign the data to the control's DataSource property and then call DataBind. This way of getting data into the controls has a few shortcomings. First of all, this method does not support the editing, updating, and deleting of data directly. Secondly, since you define the data source in the Code Behind, the GridView doesn't know what data you're feeding it until run time, so you get no tool support to set up its columns. These shortcomings are easy to overcome by using the new server controls, including the ListView and the LinqDataSource control.

13.4.1. New Controls Introduced in ASP.NET 3.5

Together with LINQ, Microsoft introduced three new controls in ASP.NET 3.5 that enable you to build rich web interfaces with little to no code in no time. Two of them provide a visual interface in your ASP.NET pages, while the third one works as a bridge between your data-bound controls and your underlying data sources. The following table briefly introduces you to these new controls.

ControlDescription
LinqDataSourceAs with the SqlDataSource that you saw in previous chapters, the LinqDataSource works as a bridge between your data-bound controls and your underlying data sources. This data source can be any of the types that LINQ supports, including SQL Server databases, XML documents, and even arrays and collections. This chapter looks at the LinqDataSource ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning ASP.NET 4: in C# and VB

Beginning ASP.NET 4: in C# and VB

Imar Spaanjaars
Professional ASP.NET 3.5 SP1 Edition: In C# and VB

Professional ASP.NET 3.5 SP1 Edition: In C# and VB

Bill Evjen, Scott Hanselman, Devin Rader

Publisher Resources

ISBN: 9780470187593Purchase book