New features for web developers in ASP.NET 2.0 - Working with Data(developerfusion.co.uk)
submitted by
cainfotech(460) 5 years, 11 months ago
ASP.NET 2.0 provides a huge number of new features that increase developer productivity, remove complexity, and make building great Web sites much easier. Much of the ‘plumbing' (the repetitive coding) that is required in version 1.0 has been replaced by innovative new controls and enhancements to the underlying page architecture. That said, most version 1. x pages will run with only minor modifications.
Working with Data
One of the most common tasks in most Web pages is working with data. In many cases the data comes from a relational database such as SQL Server, and the developer must write repetitive code to access it, display it, and push changes back into the database. In version 1. x , server-side data binding to a range of list controls reduces the amount of rendering code required. However, in version 2.0, new data source controls such as the SqlDataSource control remove the need to write any code at all for common read and update scenarios.
There are data source controls that can handle relational and XML data, and a data source control that allows you to use a separate business logic or data access layer to read and update data in an n -tier application. There are also new user interface (UI) controls that interact with the data source controls to display and allow editing of data exposed by the new data source controls. These include an updated DataGrid control named GridView, a new DetailsView control that displays data one row/record at a time, and a free-form control named FormView that uses templates to create the visible display and editing UI.
As an example, the listing below shows the complete set of ASP.NET control declarations required to display some rows from a database table in a Web page. You can see that all it contains is an SqlDataSource control and a GridView control. When the page is executed, the controls respond to events raised by ASP.NET to retrieve the rowset and display the contents. No other code is required.
<asp:SqlDataSource id="ds1" runat="server"
ConnectionString=Northwind;
Trusted_Connection=True"
SelectCommand="grid1" runat="server" DataSourceID="ds1" />
The result is shown below, along with an example of the DetailsView and the FormView controls displaying more rows from the sample Northwind database.
As well as automatically supporting inline editing, deleting and adding new rows, the combination of the new data source and the new display controls support pa
|category: ASP.NET
|Views: 1
tags:
another
Everyones tags:
No tags
Your Tags: