Home     About PeterBlum.com     Policies     Download a Licensed Product     Newsletter

DES Dynamic Data Try It   Buy It
 
PRERELEASE The official release will be 4.1. It will be a free upgrade for v4.0 users.

Separating business logic from the user interface when using Dynamic Data


What is ASP.NET Dynamic Data?

ASP.NET Dynamic Data is a technology from Microsoft that expands the toolset of ASP.NET starting with ASP.NET 3.5 SP1. Use it to build data entry web forms that interact with a database or classes that resemble a database.


How DES Dynamic Data makes it even better

DES Dynamic Data enhances almost every aspect of ASP.NET Dynamic Data. It does not introduce any improved Data Source objects, but everything else has been considered for enhancement.

Business rules

The Attributes that you assign to in your business logic classes have many improvements. You can also programmatically define business rule values at runtime that are specific to the situation.
  • Validation rules – DES Dynamic Data uses DES’s Validation Framework which is a much more powerful toolset than the native validator web controls. There are many more validator rules available and as a result, the ValidationAttributes have been overhauled and expanded. DES Dynamic Data supports validators that compare two columns, such as a start and end date.
  • Scaffolding rules – The “automatic scaffolding” engine has been replaced to handle more cases and allow programmatic definition of the list of fields. The ScaffoldColumnAttribute handles additional cases.
  • Datatypes – DES Dynamic Data recognizes many new data types and knows how to automatically use them to setup validating text for the data type.
  • Character set rules – Use the CharacterSetAttribute to assign characterset limits to text type fields. When used, FieldTemplates can setup a FilteredTextBox and associated CharacterValidator.
  • Enumerated type rules – Use the EnumeratedAttribute and EnumeratedStringAttribute to define a specific list of values allowed in an integer and string type field. With these, your user interface can offer a dropdownlist that maps text shown to the user to the internal string or integer stored in your tables.
  • Sorting rules – Use the SortableColumnAttribute to identify if a column can be sorted or not. When sortable, column titles will automatically offer a sorting interface.
[DES.CharacterSet(LettersUppercase=false, LettersLowercase=false,
   Digits=true, Space=true, OtherCharacters="-()")]
[DES.DataType(DataType.PhoneNumber)]
public object Phone { get; set; }
[DES.DateDataType(ErrorMessage="This is an error",
   SummaryErrorMessage="The {LABEL1} is an illegal date.",
   DisplayOrder=0)]
[DES.CompareTwoColumns("HireDate",
   PeterBlum.DES.ConditionOperator.LessThan, DisplayOrder=10)]
[DES.Required(DisplayOrder=1)]
[DES.Range("1900-01-01", "1999-12-31", DisplayOrder=5)]
public object BirthDate { get; set; }
[DES.DisplayName("Quantity Per Unit", DisplayNameLookupID="QPUID")]
[DES.ScaffoldColumn(AfterThisColumnName="UnitPrice")]
public object QuantityPerUnit { get; set; }
[DES.CurrencyDataType(AllowNegatives=false,
   UseCurrencySymbol=true, MaxWholeDigits=4)]
[DES.Description("The price of one unit")]
[DES.DisplayName("Unit Price")]
[DES.SortableColumn(false)]
public object UnitPrice { get; set; }
[DES.UIHint("", DefaultPropertyList="ImageWidth='50'"]
[DES.DbImageDataType(SupportedFileTypes="jpg",
   BadFormatErrorMessage="Bad format",
   ErrorMessage="Must be {EXTENSION}",
   TimeStampColumnName="PictureTimeStamp")]
public object Picture { get; set; }
Some of the Attributes in use. Point to each attribute to learn more.

FieldTemplates

FieldTemplates are UserControls containing the controls associated with a specific data type (like integer or string) and mode (readonly, edit, or insert.)

All FieldTemplates have been overhauled, and there are many new ones.
  • Validation now uses DES’s validation framework.
  • You never add actual validator controls to the FieldTemplate. Instead, you add a single control, ColumnValidatorManager, to your FieldTemplate and it uses the business rules to create the validators needed. This guarantees that your FieldTemplates always match the business rules.
  • DES’s feature-rich controls from the Peter’s Textboxes and Peter’s Date and Time are used in many FieldTemplates, such as Integer_Edit.ascx uses IntegerTextBox and Date_Edit.ascx uses DateTextBox.
  • Very little code is needed in each FieldTemplate because of a rich set of classes to create your FieldTemplates. For example, Date_Edit.ascx inherits from the PeterBlum.DES.DynamicData.DateEditFTUC class.
  • Customization of FieldTemplates can often be done without editing the actual FieldTemplate. With the Customizer control on your form, you can define property values that will be applied automatically to the controls within the FieldTemplate. For example, set the DateFormat to “Abbreviated” in the Customizer and Date_Edit.ascx will use that format.
  • FieldTemplates have been created for many datatypes that aren’t associated with DES’s own textboxes, such as support for images, URLs, and files.
<script runat="server">
  protected void Page_Init(object sender, EventArgs e)
  {
    SetUpEditableDataControl(TextBox1);
    SetUpColumnValidatorManager(CVM1);
  }
</script>
<des:IntegerTextBox ID="TextBox1" runat="server" Columns="10" />
<desDD:ColumnValidatorManager ID="CMV1" runat="server" />

FieldTemplate for integer datatypes in Edit or Insert mode.

<desDD:Customizer ID="Customizer1" runat="server"
    CurrencyTextBox_AlignRight="True"
    CurrencyTextBox_ShowSpinner="True"
    DecimalTextBox_AlignRight="True"
    DecimalTextBox_ShowSpinner="True"
    IntegerTextBox_ShowSpinner="True">
</desDD:Customizer>
<desDD:DynamicDataManager .../>
<asp:YourDataBoundControl ... />
<asp:YourDataSource ... />

Customizer control associated with all FieldTemplates contained in your DataBound control.

Webform Development

ASP.NET Dynamic Data primarily uses the PageTemplate to format a page. It offers automatic scaffolding to define the table’s columns within a PageTemplate. It becomes more complex to avoid PageTemplates or automatic scaffolding. The moment you need to customize the appearance of your list or single-record view, you must abandon scaffolding and start on a fresh form.

With DES Dynamic Data…
  • PageTemplates have been greatly simplified by removing most of the code. It now resides in an enhanced DynamicDataManager control, which knows how to create all of the event handlers for each type of databound control.
  • Use PatternTemplates to describe how to output your data. They allow you to fully control all HTML generated while automating the setup of the DataBound control. You only need to specify a list of data fields to output. For example, the DetailsView.ascx and GridView.ascx PatternTemplate files mimic the appearance of the DetailsView and GridView controls respectively.
  • Use the DynamicListView control instead of the ListView and GridView controls. It effectively merges the simplicity of setup offered by the GridView with the flexibility of the ListView by using very powerful PatternTemplates that know every part of a list-style user interface.
  • Similarly, use the DynamicFormView control instead of the FormView and DetailsView controls.
  • Use the DynamicControlPanel control to provide paging, sorting, and other commands that manipulate the data shown in the DataBound control.
  • Use the DynamicButtons control to create the buttons shown in your DataBound control. It is very smart and flexible, showing buttons that apply and helping them communicate their “commands” to the DataBound control.
  • Use the DynamicColumnTitle control in column headings to offer both the correctly labeled title and sorting capabilities.
<desDD:DynamicDataManager ID="DynamicDataManager1" runat="server">
  <Adapters>
    <desDD:DynamicListViewAdapter
     DataBoundControlID="DynamicListView1"
     SupportsEditMode="true" SupportsInsertMode="true" />
  </Adapters>
</desDD:DynamicDataManager>
<desDD:DynamicListView ID="DynamicListView1" runat="server"
  DataSourceID="ListDataSource" PatternTemplateName="GridView">
</desDD:DynamicListView>
<desDD:DynamicControlPanel ID="ControlPanel1" runat="server"
  PagedControlID="DynamicListView1" ContainerTag="Div" PageSize="5" >
  <ContainerTagAttributes Style="height:2em; text-align:center;" />
  <Fields>
    <desDD:NewCommandButtonField Text="New Record" >
      <ContainerTagAttributes Style="float:left; padding-top:4px;
        margin-right:10px;" />
    </desDD:NewCommandButtonField>
    <desDD:LinksPageSizesField Layout="Records shown[ {SIZES} ]" >
      <ContainerTagAttributes Style="float:right; padding-top:4px;
        margin-right:10px;" />
    </desDD:LinksPageSizesField>
    <desDD:PreviousPagerField />
    <desDD:InfoPagerField />
    <desDD:NextPagerField />
  </Fields>
</desDD:DynamicControlPanel>
<asp:LinqDataSource ID="ListDataSource" runat="server"
  ContextTypeName="NorthWindDataContext" TableName="Products" >
</asp:LinqDataSource>

More on DES Dynamic Data

DES Dynamic Data is a module of Peter's Data Entry Suite. But it is sold a bit differently. Unlike the other modules which require their own licenses, DES Dynamic Data uses the licenses you have for those other modules. It requires that you have a license for the Suite, or for these modules: Peter's Professional Validation, Peter's More Validators, Peter's TextBoxes, and Peter's Date and Time. You are also recommended to have Peter's Interactive Pages. As a result, you cannot buy it stand-alone.

ASP.NET Dynamic Data requires ASP.NET 3.5 SP1 or higher. As a result, DES Dynamic Data also requires that platform. It is compiled in a separate assembly from the rest of the product to allow users to continue with earlier versions of ASP.NET when not using DES Dynamic Data.

Finally, its User's Guide is so extensive, it can become a central resource when working with ASP.NET Dynamic Data.


PRERELEASE - The official release will be 4.1. It will be a free upgrade for v4.0 users.

Peter's Data Entry Suite gives you feature rich and interactive data entry web forms with over 100 web controls.
Start with better controls. Finish with better sites.
Try It   Buy It
Related products: Peter's Data Entry Suite  | Peter's Business Logic Driven UI ("BLD")  | Peter's Professional Validation  | Peter's More Validators
Peter's Date and Time  | Peter's TextBoxes  | Peter's Interactive Pages  | Peter's Input Security