D
Dave
Hi,
I have a very simple page where i am using Page.ParseControl to create
a datagrid control. When i try to run the DataBind method i get
various errors. The code for the datagrid is as follows and is fired
on OnInit
string grid = "<aspataGrid ID=\"grid2\" runat=\"server
\"><Columns><asp:TemplateColumn><ItemTemplate><asp:LinkButton ID=
\"link1\" runat=\"server\"><%# DataBinder.Eval(Container.DataItem,
\"storeId\")%></asp:LinkButton></ItemTemplate></asp:TemplateColumn></
Columns></aspataGrid>";
tempHolder.Controls.Add(this.ParseControl(grid));
In OnLoad I use FindControl method to get the grid and set its
datasource then call DataBind(). I get the following error
Cannot instantiate type 'DataBoundLiteralControl' because there is no
public parameterless constructor.
I have tried putting the databinder.eval inside the Text attribute but
i get an error saying the value cannot be null. Any help would be
greatly appreciated.
Thanks
Dave
I have a very simple page where i am using Page.ParseControl to create
a datagrid control. When i try to run the DataBind method i get
various errors. The code for the datagrid is as follows and is fired
on OnInit
string grid = "<aspataGrid ID=\"grid2\" runat=\"server
\"><Columns><asp:TemplateColumn><ItemTemplate><asp:LinkButton ID=
\"link1\" runat=\"server\"><%# DataBinder.Eval(Container.DataItem,
\"storeId\")%></asp:LinkButton></ItemTemplate></asp:TemplateColumn></
Columns></aspataGrid>";
tempHolder.Controls.Add(this.ParseControl(grid));
In OnLoad I use FindControl method to get the grid and set its
datasource then call DataBind(). I get the following error
Cannot instantiate type 'DataBoundLiteralControl' because there is no
public parameterless constructor.
I have tried putting the databinder.eval inside the Text attribute but
i get an error saying the value cannot be null. Any help would be
greatly appreciated.
Thanks
Dave