Link to home
Create AccountLog in
Avatar of DavidTanis
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).CreateChildView("levelReport") %>'>
                                                      <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?

ASKER CERTIFIED SOLUTION
Avatar of NetDeveloper
NetDeveloper
Flag of Italy image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer