Accessing and Updating Data in ASP.NET 2.0: Creating Custom Parameter Controls

Posted by: 4GuysFromRolla.com Headlines, on 01 Nov 2006 | View original | Bookmarked: 0 time(s)

A Multipart Series on ASP.NET 2.0's Data Source Controls
ASP.NET 2.0 introduced a number of new Web controls designed for accessing and modifying data. These controls allow page developers to declaratively access and modify data without writing any code to perform the data access. This article is one in a series of articles on ASP.NET 2.0's new data source controls.

  • Data Source Control Basics - explores the concepts and advantages of data source controls, and compares their usage in ASP.NET 2.0 to data access techniques in ASP.NET 1.x.
  • Accessing Database Data - shows how to use the SqlDataSource and AccessDataSource controls to query data from a relational database.
  • Filtering Database Data with Parameters - learn how to retrieve just a subset of database data based on hard-coded values and values from the querystring, other Web controls on the page, session variables, and so on.
  • Retrieving XML Data with XmlDataSource Control - see how to retrieve both remote and local XML data and display it in a data Web control.
  • Creating Custom Parameter Controls - learn how to create your own custom, declarative Parameter controls for use in the data source controls' parameters collections.
  • (Subscribe to this Article Series! )

    As discussed in previous installments of this article series, ASP.NET 2.0 ships with a number of built-in data source controls that can be used to programmatically access data (the SqlDataSource, ObjectDataSource, XmlDataSource, and so on). The SqlDataSource and ObjectDataSource commonly return or modify data based upon parameters. For example, a SqlDataSource might use a parameterized query, like SELECT * FROM TableName WHERE ColumName = @parameterName; the ObjectDataSource's parameters are those expected input parameters to the methods it invokes. In either case, the values of the parameters can be specified using Parameter controls. (See Filtering Database Data with Parameters installment for more information on using parameters with the data source controls.)

    A Parameter controls is a control whose purpose is to provide a value for a given parameter. ASP.NET 2.0 ships with seven Parameter controls - the generic ControlParameter and the more specific ControlParameter, CookieParameter, FormParameter, ProfileParameter, QueryStringParameter, and SessionParameter controls - which pull their values from web controls on the page, session state, querystring fields, and so on.

    If you need to use a value that's not provided by one of the specific Parameter controls, you can use the generic Parameter control and set its value programmatically (a topic we'll address in a future article in this series). Alternatively, you can create a customParameter control that grabs the specific data you need. Creating such a custom Parameter control is quite easy and straightforward, as we'll see in this article. Read on to learn more!
    Read More >

    Advertisement
    Free Agile Project Management Tool from Telerik
    TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
    Category: ASP.NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 1040 | Hits: 78

    Similar Posts

    • Introducing Versatile DataSources more
    • How to display data from different tables using one data source more
    • How To: Silverlight grid hierarchy load on demand using MVVM and RIA services more
    • An alternative to Crystal more
    • Why VBA Still Makes Sense more
    • Chat room questions from the EF Tips & Tricks webcast more
    • Ruminations on Multi-Tenant Data Architectures more
    • Silverlight Release History : Q2 2009 (version 2009.2.701) more
    • WPF Release History : Q2 2009 (version 2009.2.701) more
    • Better XAML By Farr: WPF Line of Business Seminar more

    News Categories

    .NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD