This project is read-only.
Infragistics Dynamic Data FieldTemplates
The Infragistics Dynamic Data Integration project is geared towards making Dynamic Data even better, by building custom FieldTemplates and other extesible items which can be used in a Dynamic Data website.

What is Dynamic Data?
If you haven't seen dynamic data in action, head over to ASP.NET and take a look at the videos and other quick start materials. The basic concept behind Dynamic Data is that it will allow you to quickly put a front end on a Database structure. You might be saying - well, what about my business logic? Aren't single tier data applications bad? Again, take a look at some of the quick starts on ASP.NET, you'll see that they've built quite a comprehensive model into Dynamic Data which allows you to validate data, enforce constraints and all of the other details you would normally rely on a 3 tier model to do.

How does Infragistics make Dynamic Data better?
Pictures are better than words, so take a look at the before and after shots. The before shot is a Dynamic Data website straight out of the box. The After shot is after attaching a few of the Infragistics edit controls.

How do I use Infragistics With Dynamic Data?
After working with Dynamic Data for about 2 minutes, I'm sure the question above popped into your head. You've got all of these cool editor controls in NetAdvantage for ASP.NET - how can you use them with Dynamic Data?

It's all about FieldTemplates and UIHints. A UIHint is an attribute that you add to your code which tells the Dynamic Data framework which edit template to use for a given property. UIHints are added to properties defined in partial classes. The reason they are defined in a partial class, is to allow you to add content to existing entities (Linq to Sql..) with out having to write gobs of code. To put it into an actual code example, if you wanted to bind to Order and OrderDetails in the northwind database, you would first create your DBML using Linq To Sql classes. Then you would create a partial class for Order and one for OrderDetails. Now you simply add your attribute makers. Below is an example of the OrderDetails class

using System.Web.DynamicData;
using System.ComponentModel.DataAnnotations;

/// <summary>
/// Summary description for OrderDetails
/// </summary>
public partial class Order_Detail


public partial class OrderDetailsMetaData
public object Quantity;

public object Discount;

public object UnitPrice;

In the example above, I'm using an external OrderDetailsMetaData class, to contain all of my attribute. Ideally the attributes could all be added to the Order_Detail class directly, but the C# language doesn't support this scenario at the moment (maybe sp2? <grin>)

The UIHint attribute is used to connect a property with an editor. In this case, we're connecting the Quantity property to the "IGIntegerWebSlider" editor.

Editors, or more specifically FieldTemplates are nothing more than fancy WebUserControls. They contain a bit of ASPX, and one or two methods. In the WebSlider example, the ASPX and C# are shown below

<%@ Control Language="C#" CodeFile="IGIntegerWebSliderEdit.ascx.cs" Inherits="IntegerEditField" %>

ValueAsString="<%# Convert.ToDouble(FieldValueEditString) %>"
LargeChangeAsString="10.00" ShowPlusMinusButtons="True"
ValueType="Int" Width="200px">
<ValueLabel Location="FloatTopOrLeft" />

public partial class Integer_EditField : System.Web.DynamicData.FieldTemplateUserControl
protected void Page_Load(object sender, EventArgs e)
RangeAttribute attr=this.Column.Attributes[typeof(RangeAttribute)] as RangeAttribute;
if (attr != null)
WebSlider1.MinValue = attr.Minimum;
WebSlider1.MaxValue = attr.Maximum;
WebSlider1.ToolTip = Column.Description;
protected override void ExtractValues(IOrderedDictionary dictionary)
dictionary[Column.Name] = ConvertEditedValue(Convert.ToInt32(WebSlider1.Value).ToString());

In the code above, we're setting the webslider's min and max values to the values defined in our metadata (RangeAttribute). Since we defined Range(0,1000) in our OrderDetailsMetaData class, the Slider will constrain the user to entering values between 0 and 1000. It's that easy!

Download the templates, along with an example website on the Releases tab. You can also download the full source code.

Stay involved! Share your comments, questions and ideas using the discussions tab.

Last edited May 16, 2008 at 2:59 PM by igtony, version 4