R
Rob
Hi,
I have a collection object that I created that inherits from ArrayList.
I then add "Programme" objects to this collection and bind it to the
datagrid using the following code:
Dim oProgrammes As New Programmes
oProgrammes.GetAll()
grdDetails.DataSource = oProgrammes
grdDetails.DataBind()
This works fine and the records are displayed in the grid. My problem is
that when I try to add a link to the first column in the grid to allow
the user to select the row by clicking on the value in the first coulmn,
I get an error message saying:
No default member found for type 'Programme'
where 'Programme' is the name of the object in the oProgrammes
collection above.
Here's the code that I'm using for the grid:
<aspataGrid id="grdDetails" runat="server" AutoGenerateColumns="False"
CssClass="grid" Width="100%">
<Columns>
<asp:TemplateColumn HeaderText="Programme Name">
<ItemTemplate>
<%#NavigateURL(Container.DataItem("Id"),
Container.DataItem("Name"))%>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="GrantCount" HeaderText="Number of
Grants</asp:BoundColumn>
<asp:BoundColumn DataField="GrantValue" HeaderText="Value
(£)"</asp:BoundColumn>
</Columns>
</aspataGrid>
Here's the code for the NavigateURL function:
Function NavigateURL(ByVal ProgrammeId As Int32, ByVal ProgrammeName As
String) As String
Return "<a href='NewProgramme.aspx?ProgrammeId=" & ProgrammeId &
"'>" & ProgrammeName & "</a>"
End Function
Any help would be appreciated.
Rob
I have a collection object that I created that inherits from ArrayList.
I then add "Programme" objects to this collection and bind it to the
datagrid using the following code:
Dim oProgrammes As New Programmes
oProgrammes.GetAll()
grdDetails.DataSource = oProgrammes
grdDetails.DataBind()
This works fine and the records are displayed in the grid. My problem is
that when I try to add a link to the first column in the grid to allow
the user to select the row by clicking on the value in the first coulmn,
I get an error message saying:
No default member found for type 'Programme'
where 'Programme' is the name of the object in the oProgrammes
collection above.
Here's the code that I'm using for the grid:
<aspataGrid id="grdDetails" runat="server" AutoGenerateColumns="False"
CssClass="grid" Width="100%">
<Columns>
<asp:TemplateColumn HeaderText="Programme Name">
<ItemTemplate>
<%#NavigateURL(Container.DataItem("Id"),
Container.DataItem("Name"))%>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="GrantCount" HeaderText="Number of
Grants</asp:BoundColumn>
<asp:BoundColumn DataField="GrantValue" HeaderText="Value
(£)"</asp:BoundColumn>
</Columns>
</aspataGrid>
Here's the code for the NavigateURL function:
Function NavigateURL(ByVal ProgrammeId As Int32, ByVal ProgrammeName As
String) As String
Return "<a href='NewProgramme.aspx?ProgrammeId=" & ProgrammeId &
"'>" & ProgrammeName & "</a>"
End Function
Any help would be appreciated.
Rob