Click to Download C# Example StronglyTypedDataControlsInCSharp.zip
Click to Download VB.NET StronglyTypedDataControlsInVBNET.zip
Strongly Typed Data Controls features newly introduce in vNext series. New ItemType Property for controls who has "template" Concept like Repeater, Grid, Form View etc.. Strongly typed data-controls is a small, but very good feature that makes work with data bound expressions easier and cleaner.
ASP.NET Web Forms introduced the concept of "templates" starting with the very first release. Templates allow you to customize (or override) the markup of server controls, and are typically used with data binding expressions.
When using data binding within a template we used late bound expressions to bind to the data. For example, we are using the Eval() helper method for binding data. the "customer_id" and "customer_name" properties from a list of objects data bound to a repeater control like this :
In .Net 4.5 there is new strongly-typed data templates in that new "ItemType" property introduce on data controls. With the help of this property we declare that what type of data is going to be bound to data control.
Where you set "ItemType" property to object at that time there are two new typed variables to be generated in the scope of the data bound template. These variables are "Item" and "BindItem".
We can use these variables in data binding expressions and get Intellisense and compile time checking support.
IntelliSense Display :
If we make any mistake while typing the field name we will receive error message from IntelliSense engine.
IntelliSense Error :
Here is example for this.
Click to Download VB.NET StronglyTypedDataControlsInVBNET.zip
Strongly Typed Data Controls features newly introduce in vNext series. New ItemType Property for controls who has "template" Concept like Repeater, Grid, Form View etc.. Strongly typed data-controls is a small, but very good feature that makes work with data bound expressions easier and cleaner.
ASP.NET Web Forms introduced the concept of "templates" starting with the very first release. Templates allow you to customize (or override) the markup of server controls, and are typically used with data binding expressions.
When using data binding within a template we used late bound expressions to bind to the data. For example, we are using the Eval() helper method for binding data. the "customer_id" and "customer_name" properties from a list of objects data bound to a repeater control like this :
<asp:Repeater runat="server" ID="Repeater1"> <ItemTemplate> ID : <%# Eval("customer_id") %> <br /> Name : <%# Eval("customer_name") %> <br /> <hr> <br /> </ItemTemplate> </asp:Repeater>
In .Net 4.5 there is new strongly-typed data templates in that new "ItemType" property introduce on data controls. With the help of this property we declare that what type of data is going to be bound to data control.
Where you set "ItemType" property to object at that time there are two new typed variables to be generated in the scope of the data bound template. These variables are "Item" and "BindItem".
We can use these variables in data binding expressions and get Intellisense and compile time checking support.
IntelliSense Display :
![]() |
| (To view original image , click on image) |
If we make any mistake while typing the field name we will receive error message from IntelliSense engine.
IntelliSense Error :
![]() |
| (To view original image , click on image) |
Here is example for this.

