Strongly-Typed Binding for List Controls
page 1 of 5
Published: 05 May 2004
Abstract
This article briefly covers the implementation of two types that can be used to bind list controls, such as the DropDownList, in a strongly-typed manner to a SQL Server data source using stored procedures.
by J. Ambrose Little
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 18083/ 173

Introduction

[Download Sample Project]

This article briefly covers the implementation of two types that can be used to bind list controls, such as the DropDownList, in a strongly-typed manner to a SQL Server data source using stored procedures.  I think the main application of this concept, as demonstrated by the sample code, is for menu and list controls that usually provide a friendly display value (name or text) and a hidden value, but there may be more.  It could be used in any situation where you need a name-value pair collection. 

The usefulness of this architecture is up for debate--it may be more work than it's worth--but I hope you'll find it is at least an interesting exercise.  Please send me feedback on whether or not you think it is useful, whether you end up using it in a real application, and please rate the article using the rating system that is located at the bottom of the article pages.

There are basically two core types involved in this architecture, the NameValuePair and the NameValuePairCollection.  The NameValuePair type has only two properties--Name and Value.  It is the so-called "business" or "domain" object that represents an individual name-value pair (menu option). 

The second type is, more or less, your standard collection type (the need for which will be replaced with generics in Whidbey), but it does have some custom functionality and data that give this a bit of umph.  There are really three core additions to the basic collection functionality:  FillFromDb, BindToListControl, and the BuildingParameters event (and related argument structure, delegate, and raising method).

 


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 3 and 8 and type the answer here:

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 
Learn More
.NET Tools
asp.net shopping cart
asp.net chart control






Ads Powered by Lake Quincy Media
Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2008 ASPAlliance.com  |  Page Processed at 9/7/2008 8:46:13 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search