In my current project, we are using CodeSmith + netTiers as framework. It is a great framework for rapid development.
Today I will explain how to use DeepLoad features in netTiers.
We have two tables, one is PortalReports, it contains a foreign key call ReportTypeId to the other table call PortalReportTypes. In PortalReportTypes we have a column call ReportTypeName. What we want is in GridView, we need to show ReportTypeName rather than ReportTypeId. I think it is a very common requirement. So how can be done using the DeepLoad features in netTiers framework and not write any code?
AllowPaging = " true " runat = " server " AutoGenerateColumns = " false " Width = " 500px " >
< Columns >
< asp:TemplateField >
< HeaderTemplate > Report Type </ HeaderTemplate >
< ItemTemplate ><% #Eval( " ReportTypeIdSource.ReportName " ) %></ ItemTemplate >
</ asp:TemplateField >
</ Columns >
</ asp:GridView >
< data:PortalReportsDataSource ID = " dsReport " runat = " server " EnablePaging = " True " EnableSorting = " True " EnableTransaction = " False " SelectMethod = " GetPaged " EnableDeepLoad = " true " >
< DeepLoadProperties Method = " IncludeChildren " Recursive = " false " >
< Types >
< data:PortalReportsProperty Name = " PortalReportTypes " />
</ Types >
</ DeepLoadProperties >
</ data:PortalReportsDataSource >
The import things here are
1. EnableDeepLoad="true"
2. <%#Eval("ReportTypeIdSource.ReportName")%> should be foreignkey+"Source".PropertyName