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

2 posts, 0 answers
  1. Esteban
    Esteban avatar
    2 posts
    Member since:
    Mar 2008

    Posted 30 Jul 2013 Link to this post

    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>


  2. Marin
    Admin
    Marin avatar
    1045 posts

    Posted 02 Aug 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top