Enabling Editing Using the DataList

Using the DataList control rather than the DataGrid gives you significantly more control over the layout of the rendered page. For example, since the DataList doesn't have a default look, you can have one look for items while in edit mode and another for those that are not. Listing 10.3 uses the DataList with editing enabled. After this listing, we'll dissect the code used for editing to show you exactly what's going on.

Listing 10.3. Enabling Editing in the DataList
 [Visual Basic] 01: <%@ import namespace="System.Data" %> 02: <%@ import namespace="System.Data.SqlClient" %> 03: <script language="vb" runat="server"> 04: private sSqlCon as string = "server=localhost;uid=sa;pwd=;database=northwind" 05: 06: public ...

Get Programming Data-Driven Web Applications with ASP.NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.