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

  • Thread starter Thread starter hellosticky
  • Start date Start date
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
 
Back
Top