DavidTanis
asked on
Data Binding in datagrid
Hi, I'm trying to have a datagrid within a datagrid...here is the codes:
<asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns="False ">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<%# Databinder.Eval(Container. DataItem, "level0") %>
<asp:DataGrid id=DataGrid2 runat="server" DataKeyField="level0" DataSource='<%# CType(Container.DataItem, DataRowView).CreateChildVi ew("levelR eport") %>'>
<Columns>
<asp:TemplateColumn>
<%# DataBinder.Eval(Container. DataItem, "report") %>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
But I am receiving an error :
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Code blocks are not supported in this context.
Source Error:
Line 21: <Columns>
Line 22: <asp:TemplateColumn>
Line 23: <%# DataBinder.Eval(Container. DataItem, "report") %>
Line 24: </asp:TemplateColumn>
Line 25: </Columns>
Any idea?
<asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns="False
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<%# Databinder.Eval(Container.
<asp:DataGrid id=DataGrid2 runat="server" DataKeyField="level0" DataSource='<%# CType(Container.DataItem, DataRowView).CreateChildVi
<Columns>
<asp:TemplateColumn>
<%# DataBinder.Eval(Container.
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
But I am receiving an error :
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Code blocks are not supported in this context.
Source Error:
Line 21: <Columns>
Line 22: <asp:TemplateColumn>
Line 23: <%# DataBinder.Eval(Container.
Line 24: </asp:TemplateColumn>
Line 25: </Columns>
Any idea?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.