Skip to Content
ASP.NET 3.5 For Dummies®
book

ASP.NET 3.5 For Dummies®

by Ken Cox
February 2008
Intermediate to advanced
428 pages
8h 52m
English
For Dummies
Content preview from ASP.NET 3.5 For Dummies®

8.2. Enhancing Usability with LinqDataSource

The grid in the preceding section handles adding, editing, and deleting products. However, it's not friendly. In this section, you replace the supplier number with the company name to make it easier for users to add products.

8.2.1. Putting a name to a number

At runtime, the ListView you create in the preceding section shows SupplerID and CategoryID values, which are numbers. Instead of asking viewers to match the SupplierID to the company name, you can do it for them. Figure 8-2 shows that NWDataClasses.dbml includes a Supplier object with a CompanyName property. Both the company and category names are available to display in the ListView control.

Figure 8-2. The Supplier object with a CompanyName property.

Follow these steps to use the name of the supplier in the SupplierID column:

  1. Open products.aspx in Source view.

  2. Open the Quick Replace window (EditFind and ReplaceQuick Replace).

  3. Set Eval("SupplierID") as the Find What text and Eval("Supplier.CompanyName") as the Replace With text in the current document.

  4. Click Replace All.

    Three occurrences are replaced.

  5. Set Eval("CategoryID") as the Find What text and Eval("Category.CategoryName")

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

ASP.NET 3.5 Unleashed

ASP.NET 3.5 Unleashed

Stephen Walther
ASP.NET 4 Unleashed

ASP.NET 4 Unleashed

Stephen Walther, Kevin Hoffman, Nate Dudek

Publisher Resources

ISBN: 9780470195925Purchase book