Use reflections to bind business objects to ASP.NET Form Controls

xiaoxiao2021-03-06  40

Use reflections to bind business objects to ASP.NET Form Controls

Release Date: 12/10/2004

| Update Date: 12/10/2004

John Dyerdallas theology seminary

Applicable to: Microsoft Visual Studio 2005 and Early Version ASP.NET 1.1C # Programming Language Visual Basic Programming Language

Summary: Use reflection to bind business objects to the ASP.NET web form, reducing complexity and decrease errors. (This article contains links to English sites. Please note that in the sample file, the programmer's comment is in English. In this paper, it is translated into Chinese to facilitate the reader.)

Download the MSDFORMBINDING.MSI sample file.

This page

Introduction Simplification and shortening the form code Start: Retrieving the property list from the reflection to the value of the object property value to the control with a known property to set the values ​​of the unknown control: BindControlstoobject performance and extension of the FORMBINDING

introduction

Among the most common tasks of the web developer, there is a task that they want to perform repeatedly: Establish a simple form for updating the database table. We will create a list page and a form page, and the list is displayed in a table form, and the form page has an appropriate form control for each database field. Many developers also use business objects that represent database tables to a multi-layer design. If the database table (Documents) is used in the business object, many forms of forms look like this: