This is a migrated thread and some comments may be shown as answers.

Adding RadPivotGrid to an MVC project - Script controls may not be registered after PreRender

1 Answer 85 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Esteban
Top achievements
Rank 1
Esteban asked on 30 Jul 2013, 06:41 PM
Hello,
I'm trying to add a RadPivotGrid to an MVC project.  I followed the pattern mentioned here for regular Grids: http://www.telerik.com/help/aspnet-ajax/mvc-radgrid-databinding.html, but when I try to bind, I get this error: "Script controls may not be registered after PreRender".

Is it possible to do this?  This is what my view looks like:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Report/Reports.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <%
        RadPivotGrid1.DataSource = ViewData["GridData"];
        RadPivotGrid1.DataBind();
    %>
    <telerik:RadAjaxPanel ID="radAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
        <br />
        <br />

        <telerik:RadPivotGrid AllowPaging="True" Width="800px" Height="400px"
            ID="RadPivotGrid1" runat="server" ColumnHeaderZoneText="ColumnHeaderZone">
            <ClientSettings EnableFieldsDragDrop="true">
                <Scrolling AllowVerticalScroll="true"></Scrolling>
            </ClientSettings>
            <Fields>
                <telerik:PivotGridRowField DataField="Field1">
                </telerik:PivotGridRowField>
                <telerik:PivotGridRowField DataField="Field2">
                </telerik:PivotGridRowField>
                <telerik:PivotGridColumnField DataField="Field3">
                </telerik:PivotGridColumnField>
            </Fields>
            <SortExpressions>
                <telerik:PivotGridSortExpression FieldName="Field1" SortOrder="Descending"></telerik:PivotGridSortExpression>
            </SortExpressions>
        </telerik:RadPivotGrid>
    </telerik:RadAjaxPanel>

        

</asp:Content>


1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 02 Aug 2013, 02:03 PM
Hello,

 Unfortunately the RadPivotGrid does not support this approach of databinding in the code with calling the DataBind() method. That's why it is not suitable for use in MVC projects, its databinding and event mechanism is not compatible with the MVC framework.

Regards,
Marin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Ajax
Asked by
Esteban
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or