Cannot instantiate type 'DataBoundLiteralControl' because there is no public parameterless construct

H

hellosticky

I have created a custom UserControl which emulates a DataGrid control.
Internally, it simply instantiates an instance of a DataGrid control
and adds it to its Controls collection, as well as initializing the
various properties of the DataGrid, including the Properties
collection, which is initialized as follows:

DataGridColumn col;
foreach (object o in Columns.Items)
{
col = o as DataGridColumn;
if (col != null)
{
m_dataGrid.Columns.Add(col);
}
}

Everything works with <asp:BoundColumn /> columns, but when I introduce
a TemplateColumn with a DataBind expression, I get the exception:

Cannot instantiate type 'DataBoundLiteralControl' because there is no
public parameterless constructor.

I don't even know how to debug this. Furthermore, if I remove the
expressoin <%# "test" %> and just put normal HTML like "test," it
works. So, for some reason, it can't evaluate DataBind expression.

Thanks
 

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

Asp.net Important Topics. 0

Top