I am getting an error when using the Infragistics WebDataGrid on my SharePoint site with using only dynamic columns.
The error is: [HttpException]: The controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Can you please help?
protected void Page_Load(object sender, EventArgs e)
{
List<CustomObject> customObjects = new List<CustomObject>();
CustomObject customObject = new CustomObject();
customObject.ID = 1;
customObject.Col1 = "Super Cool Stuff1";
customObject.Col2 = "Super Cool Stuff2";
customObject.Col3 = "Super Cool Stuff3";
customObject.Col4 = "Super Cool Stuff4";
customObjects.Add(customObject);
customObject = new CustomObject();
customObject.ID = 2;
customObject.Col1 = "Super Cool 1";
customObject.Col2 = "Super Cool 2";
customObject.Col3 = "Super Cool 3";
customObject.Col4 = "Super Cool 4";
customObjects.Add(customObject);
this.WebDataGrid1.DataSource = customObjects;
this.WebDataGrid1.DataBind();
}
public class CustomObject
{
public int ID { get; set; }
public string Col1 { get; set; }
public string Col2 { get; set; }
public string Col3 { get; set; }
public string Col4 { get; set; }
}
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="244px" Width="1030px" DataKeyFields="ID">
<behaviors>
<ig:Filtering FilterType="ExcelStyleFilter">
</ig:Filtering>
</behaviors>
</ig:WebDataGrid>