Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 70,456 times

Contents

Downloads

Related Categories

Implementing two-way Data Binding for ASP.NET - Introduction

rstrahl

Introduction

ASP.NET has raised the bar for Web development considerably with very rich developer functionality built into a flexible and highly extensible object model. For developers who come from a background of hand coding ASP or other scripting or CGI style technology .Net seems almost too good to be true as it reduces a lot of redundant code and simplifies the development process significantly. But one area – simple data binding for controls like textboxes, checkboxes, radio buttons and so on leave a lot to be desired both in terms of ease of use for binding the data as well as providing the ability to read the data back into the data source. In this article Rick examines what's wrong with simple data binding and provides a set of subclasses that make data binding a lot quicker requiring much less manual code.

Data binding tends to be one of the tasks that most developers deal with on a daily basis. Most applications are data centric and whenever you create user interface code that relates to the data you'll find that if you use the default mechanisms of the .Net Framework that you'll do the same things over and over again. Not only that, but .Net really doesn't make data binding as easy as it should be either in Windows Forms or in ASP. Net. In this article, I'll describe briefly how data binding in ASP. Net works and then offer a solution to make the process of data binding much easier by using subclassed controls that handle the repetitive tasks. In a future article I'll then discuss the same issues in Windows Forms.

If you're coming from an ASP or other Web Development background, you're probably thinking “what is Rick talking about?” Data binding in ASP.NET is a huge improvement over whatever I had to do previously in Web forms. After all we do have a form of data binding (actually several forms) in .Net and we have various forms of state management that automatically assign our control values back to the controls so we're free of having manually populate fields with data. Big improvement for sure.

Comments

  • thank you, great solution

    Posted by CaptainSensible on 16 Jan 2006

    wow,
    absolute great. It helped me a lot in creating forms during runtime. All controls had to generated from database information. So I neede a way to check bind the values by looping through the wh...

  • Great stuff!!!

    Posted by ITBG on 01 Feb 2005

    Great stuff!!!
    I find your article really usefull.