Spread for ASP.NET 9.0 Product Documentation > Developer's Guide > Getting Started > Working with the Component > Working with Strongly Typed Data Controls |
Strong-typed data controls support binding using a new syntax that is available in ASP.NET 4.5. This allows you to directly reference properties on the data source object in the markup. For example, in order to bind data to PreviewRowTemplate and RowEditTemplate before ASP.NET 4.5, code to bind to the FirstName property on your data source item looked like this:
Code |
Copy Code
|
---|---|
<FarPoint:FpSpread ID="FpSpread1"> <Sheets> <FarPoint:SheetView SheetName="Sheet1"> <PreviewRowTemplate> First Name is: <%#DataBinder.Eval(Item, "FirstName") %> </PreviewRowTemplate> <RowEditTemplate> First Name is: <%#DataBinder.Eval(Item, "FirstName") %> </RowEditTemplate> </FarPoint:SheetView> </Sheets> </FarPoint:FpSpread> |
With ASP.NET 4.5 you can use code like the following:
Code |
Copy Code
|
---|---|
<FarPoint:FpSpread ID="FpSpread1"> <Sheets> <FarPoint:SheetView SheetName="Sheet1"> <PreviewRowTemplate> First Name is: <%#Item.FirstName %> </PreviewRowTemplate> <RowEditTemplate> First Name is: <%#Item.FirstName %> </RowEditTemplate> </FarPoint:SheetView> </Sheets> </FarPoint:FpSpread> |
Using code in your markup this way allows you to get the added benefits of IntelliSense listing of your data source object's properties and validation of the property name at design time.