Thursday, May 26, 2005
Prior to coding modules for DNN I never used ArrayLists for DataGrid databinding. So that's when I ran into the 'no default member found for type' runtime error when trying to code a template column. As you know, when you bind to a DataSet and you need a field from the current record you use 'Container.DataItem('FieldName')'. I thought that in the DNN world with ArrayLists of Info objects the same would work but it does not. Turns out that Container.DataItem returns the object so you need to specify the property if there is no default one. For my http://www.ammotracker.com site I use it as follows:

<asp:TemplateColumn headertext="Gun"%>
<ItemTemplate%>
<asp:Label runat="server"%> <%# GetGunForSession(Container.dataitem().GT_OwnerGuns_ID) %></asp:Label%>
</ItemTemplate%>
</asp:TemplateColumn%>

Enjoy!