2

在我的 SharePoint 网站上使用 Infragistics WebDataGrid 且仅使用动态列时出现错误。

错误是:[HttpException]:控件集合无法修改,因为控件包含代码块(即<% ... %>)。

你能帮忙吗?

    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>
4

0 回答 0