Strongly Typed Data Controls – Part 2


As per the previous post, the next release of ASP.NET provides the ability to enable strongly-typed data templates.  Specifically, addition of the ability to declare what type of data a control is going to be bound to, by way of a new “ModelType” property on data controls.  This will cause two new typed variables to be generated in the scope of the data-bound template expressions: Item and BindItem.
ASP.NET developers can use these variables in data-binding expressions and get full compile-time checking support.  Check this below example, here we’ve set the ModelType on an <asp:repeater> control to be a “Customer” object.  Once we do this we can switch from using Eval(“FirstName”) to instead use Item.FirstName to reference the property.  

We get full Visual Studio code intellisense when we do so:

Support for strongly typed data-controls is a small, but nice, feature that makes working with data-bound expressions easier and cleaner.  Thus, usage of ASP.NET vNext in programming platforms makes data-binding and data-editing even more powerful and easy for sure.
At SPEC India, we develop the simple as well as complex and the most robust web applications and websites in ASP.NET with C# as well as VB.NET. We have a trained team of around 135 in total to support our Client’s requirement, and our ASP.NET team is around 20 trained software professionals. We have been in this field since 1989, serving our esteemed Clients. If you have any requirement related to this, then kindly let us know and someone of our team will be happy to assist you.

Post a Comment