Hi,
i have a problem using AJAX with the WebDataGrid in a SharePoint 2010 Visual WebPart. The Page will come up without any Problem. But if there is an asynchronous refresh e.g. if using the filter or the paging behavior i will get the following error message:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)
My Code (ASPX):
<%@ Register Assembly="Infragistics35.Web.v10.1, Version=10.1.20101.2134, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" TagPrefix="igtbl" Namespace="Infragistics.Web.UI.GridControls" %><%@ Register Assembly="Infragistics35.Web.v10.1, Version=10.1.20101.2134, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" TagPrefix="ig" Namespace="Infragistics.Web.UI.ListControls" %><%@ Register Assembly="Infragistics35.Web.v10.1, Version=10.1.20101.2134, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" TagPrefix="igsch" Namespace="Infragistics.Web.UI.EditorControls" %> <div id="container" runat="server"> <div id="DataGridWrapper"> <igtbl:WebDataGrid ID="WebDataGrid1" runat="server" Height="500px" Width="800px" AutoGenerateColumns="False" EnableAjax="true" EnableViewState="false" EnableDataViewState="false" ClientEvents-AJAXResponse="277A67FD-9934-432E-9D76-BF48862DE8DD"> <Columns> <igtbl:BoundDataField DataFieldName="USER_ID" Key="USER_ID"> <Header Text="CWID" /> </igtbl:BoundDataField> <igtbl:BoundDataField DataFieldName="FULL_NAME" Key="FULL_NAME" Width="150px"> <Header Text="Name" /> </igtbl:BoundDataField> <igtbl:BoundDataField Key="PLANNED_DATE"> <Header Text="Planned Date" /> </igtbl:BoundDataField> </Columns> <Behaviors> <igtbl:Paging PageSize="100" PagerAppearance="Bottom" Enabled="true"/> <igtbl:Filtering Enabled="true" AnimationEnabled="false"/> <igtbl:RowSelectors Enabled="true"/> <igtbl:Selection CellSelectType="Single" RowSelectType="Multiple" ColumnSelectType="Multiple" Enabled="true" /> </Behaviors> </igtbl:WebDataGrid> </div> </div>
Code behind:
protected override void OnInit(EventArgs e) { base.OnInit(e); try {
SPSecurity.RunWithElevatedPrivileges(delegate { UserService userService = new UserService(ServerAndInstance, Database); WebDataGrid1.DataSource = userService.GetTopUsers(); WebDataGrid1.DataBind(); }); } catch (Exception) { throw new ApplicationException(WebDataGrid1.EmptyRowsTemplate.ToString());
} }
WebPartCode:
protected override void CreateChildControls() { UserControl uc = (UserControl)Page.LoadControl(_ascxPath); UserControl.Database = databaseName; UserControl.ServerAndInstance = SQLServer;
Controls.Add(UserControl);
}
For additional information:
I'm using the default SharePoint 2010 Design with the v4.master MasterPage.
Can someboy help?
Did you solve this by any chance? I'm having the exact same error, it works if i disable ajax or if i put the usercontrol right on the page, e.g. in an application page or page layout. However i'd like to have it as a webpart.
no, still no solution for the problem.
Hello Ansgar,
I have created a support case CAS-60571-9S0KBZ for you. I am currently looking on to this issue. I will update you with my findings and keep you posted.
Thanks,
Bhadresh
Hi Infragistics Team
When this Problem you can solve? Our Customer wait for an solution and it is very urgent. If we not have an solution for this then we have to replace the Controls with other that works.
Thanks
Hello,
I got the same problem with WebHierarchicalDataGrid v10.3. Any solutions?
Thank you.
I don't have access to our code anymore but i know we solved this issue by putting a div with runat="server" around the webdatagrid, did you try that already? I noticed this is already there in the initial post of this thread not sure why it doesnt work there maybe the server side code is giving an issue in that case..
Hope this helps