Datagrid ParseControl error on DataBind

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 = "<asp:DataGrid 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></asp:DataGrid>";
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DataBind 1
Display datagrid records 6
ASP.NET Datagrid 1
More ParseControl() 1
datagrid 4
wrapping text in datagrid 1
Prob w/ Datagrid 9
Error referencing Datagrid table cell 3

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top