:congrats:Hello ,
I have the following code:
public class abc
{
public string customername { get; set; }
public List<def> DEF { get; set; }
}
public class def
{
public string materialcode { get; set; }
}
on page load
protected void Page_Load(object sender, EventArgs e)
{
List<abc> test1 = new List<abc>();
List<def> test2 = new List<def>();
test2.Add(new def() {materialcode="something" });
test1.Add(new abc(){customername="anything", DEF=test2});
GridView1.DataSource = test1;
GridView1.DataBind();
}
and in the ascx file
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField HeaderText="Charge Code">
<ItemTemplate>
<asp:Label ID="lblchargecode" runat="server" Text='<%#((def)Eval("DEF"))[0].materialcode %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
I am getting an error message stating that def is not a member , if i am missing an assembly reference.
Please help me bind it to the gridview. Its very urgent
Thanks all.
I have the following code:
public class abc
{
public string customername { get; set; }
public List<def> DEF { get; set; }
}
public class def
{
public string materialcode { get; set; }
}
on page load
protected void Page_Load(object sender, EventArgs e)
{
List<abc> test1 = new List<abc>();
List<def> test2 = new List<def>();
test2.Add(new def() {materialcode="something" });
test1.Add(new abc(){customername="anything", DEF=test2});
GridView1.DataSource = test1;
GridView1.DataBind();
}
and in the ascx file
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField HeaderText="Charge Code">
<ItemTemplate>
<asp:Label ID="lblchargecode" runat="server" Text='<%#((def)Eval("DEF"))[0].materialcode %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
I am getting an error message stating that def is not a member , if i am missing an assembly reference.
Please help me bind it to the gridview. Its very urgent
Thanks all.