smartDBforms.NET LIVE DEMO by Adillis
 
Start Page
Short introduction to smartDBforms.NET

A database form created with smartDBforms.NET consists of the following basic elements:

  • SmartDataSource server control. SmartDataSource uses the specified sql statements to extract and modify data from the database.

  • SmartDBView server control, which represents one form. The SmartDBView displays the data returned by the SmartDataSource control. When the user has finished editing the data SmartDBView sends the data to SmartDataSource for database persistence. SmartDBView has three modes: ReadOnly, Edit and Insert. The following command buttons: Edit, New, Clone, Update, Insert, Cancel and Delete, are available. They change the mode of the form and trigger database operations.

  • The third important element is SmartDBControl. SmartDBControl is responsible for displaying and editing the data for one database field. In the case of a multi-column foreign key relation, SmartDBControl takes care for all the fields that are part of the relation.

Here is an example of a simple database form for the Region table from Northwind database. The Region table has only two columns:

  • RegionID – Primary key of type int.

  • RegionDescription – Non null, its type is nchar(50).

Here is a screenshot of the form in Visual Studio 2005 .NET design time. The SmartDBView was switched to “Show Placeholders” mode. In this mode the child SmartDBControls display the name of the database field they represent.

 

By default in design time SmartDBControl is displayed in the same way as it will be rendered at runtime. This is a design time screenshot where SmartDBView's “Show Placeholders” mode is not enabled.

 

Here is the ASP.NET source of this sample. Some parts have been dropped for brevity.

<!-- SmartDBView for Regions -->
<smartDBforms:SmartDBView ID="RegionsView"  DataSourceID="RegionsDataSource" 
          DefaultMode="ReadOnly" runat="server">
  <Content>
   
    <!-- SmartDBControls-->
     <smartDBforms:SmartDBControl Field="RegionID"ID="ctrlRegionID" runat="server" />

     <br />

     <smartDBforms:SmartDBControl Field="RegionDescription" ID="ctrlRegionDescription"
            runat="server" />

     <br />

     <!-- Command buttons -->
      <asp:Button ID="btnEdit" runat="server" CommandName="Edit" Text="Edit" />
       ...
  </Content>
</smartDBforms:SmartDBView>


<!-- SmartDataSource for Regions -->
<smartDataSource:SmartDataSource ID="RegionsDataSource" runat="server" 
     ConnectionString="..."
     SelectCommand="SELECT RegionID, RegionDescription FROM Region WHERE (RegionID = @RegionID)"
     UpdateCommand="UPDATE Region SET ...">
     DeleteCommand="DELETE FROM Region WHERE ..."
     InsertCommand="INSERT INTO Region..."
     ....         
</smartDataSource:SmartDataSource>
    

When SmartDBControl is databound an user interface template is selected according to the database schema. This user interface template is used to render the controls which will display the data. The user interface template is also used to extract the entered data.

All templates are stored in a special Web user control. The Web user control inherits from TemplatesUserControl class.

Here is for example how the template for text values looks like:

 

   Copyright © 2006-2011 Adillis   |   smartDBforms.NET Forum   |    Send feedback