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

Error: Script controls may not be registered after PreRender

3 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Muhammad
Top achievements
Rank 1
Muhammad asked on 29 Jun 2013, 10:56 AM
Hi,

I'm using Asp.Net MVC application in which i've used rad grid. Application runs fine, but when i set allowpaging = true, above error appears.
Please note that there is no code-behind file of aspx file. Here is the markup code.

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<WeBOC.DAL.Vessel>" %>
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>
 
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
 
    <form id="form1" runat="server">
 
    <h2>Vessels<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
        </telerik:RadScriptManager>
    </h2>
     
    <%
        RadGrid1.DataSource = ViewData["Vessels"];       
        RadGrid1.DataBind();
    %>
 
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false"
        CellSpacing="0" GridLines="None" Skin="WebBlue" AllowPaging="True">
        <MasterTableView>
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
 
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="VIR_NO" HeaderText="VIR No." />
                <telerik:GridBoundColumn DataField="INBOUND_VOY_NO" HeaderText="I/B Voyage" />
                <telerik:GridBoundColumn DataField="OUTBOUND_VOY_NO" HeaderText="O/B Voyage" />
                <telerik:GridBoundColumn DataField="VESSEL_NAME" HeaderText="Vessel Name" />
                <telerik:GridBoundColumn DataField="ARRIVAL_DATE" HeaderText="Arrived" />
                <telerik:GridBoundColumn DataField="STATE" HeaderText="Phase" />
            </Columns>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
 
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
        </MasterTableView>
 
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
 
    </telerik:RadGrid>
 
     
    </form>
 
</asp:Content>

And hers is the stack trace..

   at System.Web.UI.ScriptControlManager.RegisterScriptControl[TScriptControl](TScriptControl scriptControl)
   at System.Web.UI.ScriptManager.RegisterScriptControl[TScriptControl](TScriptControl scriptControl)
   at Telerik.Web.UI.RadDataBoundControl.RegisterScriptControl()
   at Telerik.Web.UI.RadDataBoundControl.ControlPreRender()
   at Telerik.Web.UI.RadDataBoundControl.OnPreRender(EventArgs e)
   at Telerik.Web.UI.RadComboBox.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.AddedControl(Control control, Int32 index)
   at System.Web.UI.ControlCollection.Add(Control child)
   at Telerik.Web.UI.GridPagerButtonBuilder.CreatePageSizeDropDown(Panel container)
   at Telerik.Web.UI.GridPagerButtonBuilder.CreatePageSize(Panel container)
   at Telerik.Web.UI.GridPagerItem.InitializePagerItem(GridColumn[] columns)
   at Telerik.Web.UI.GridPagerItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows)
   at Telerik.Web.UI.GridTableView.CreateTopPagerItem(Boolean useDataSource, GridColumn[] copiedColumnSet, Boolean isPagingEnabled, GridTHead thead)
   at Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource)
   at Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource)
   at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
   at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
   at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
   at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
   at Telerik.Web.UI.GridTableView.PerformSelect()
   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
   at Telerik.Web.UI.GridTableView.DataBind()
   at Telerik.Web.UI.RadGrid.DataBind()
   at ASP.views_vessel_index_aspx.__Renderform1(HtmlTextWriter __w, Control parameterContainer) in d:\Projects\WeBOC.MVC\WeBOC.MVC\Views\Vessel\Index.aspx:line 19
   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
   at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer)
   at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer)
   at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output)
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
   at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
   at System.Web.UI.Control.Render(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
   at ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\Projects\WeBOC.MVC\WeBOC.MVC\Views\Shared\Site.Master:line 29
   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
   at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
   at System.Web.UI.Control.Render(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
   at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
   at System.Web.UI.Page.Render(HtmlTextWriter writer)
   at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Application get stuck at RadGrid1.DataBind( ); I've searched alot but unable to find the solution. Any help would be appreciated.

Thanks
Ovais

3 Answers, 1 is accepted

Sort by
0
Muhammad
Top achievements
Rank 1
answered on 02 Jul 2013, 08:00 AM
Still waiting for reply, please help me out.
0
Princy
Top achievements
Rank 1
answered on 02 Jul 2013, 09:05 AM
Hi Muhammad,

I tried to replicate the issue but no avail.Please bind the radgrid using NeedDataSource event of the radgrid.
Paging, Sorting and Filter works fine when the RadGrid is bound with Advanced Data-binding (using NeedDataSource event).
Please refer to this link on Advanced Data-binding (using NeedDataSource event).

Thanks,
Princy
0
Muhammad
Top achievements
Rank 1
answered on 02 Jul 2013, 09:46 AM
Thanks, it works..
Tags
Grid
Asked by
Muhammad
Top achievements
Rank 1
Answers by
Muhammad
Top achievements
Rank 1
Princy
Top achievements
Rank 1
Share this question
or