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

Script controls may not be registered after PreRender in Beta

1 Answer 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
MGrassman
Top achievements
Rank 2
MGrassman asked on 01 Jul 2010, 05:33 PM
I am recieving the following error when I upgrade past version v.21010.1.216.35.  I have tried this with v.2010.1.519.35 and v.2010.2.623.35.

The page loads fine with the 216 but when I upgrade to a newer version I recieve "Script controls may not be registered after PreRender"  My app doesn't change I just use the telerik upgrade option in the file menu.

ASPX Page
<script type="text/javascript" language="javascript">  
        function RowDeleted(sender, eventArgs) {  
            PageMethods.MarkRecordDeleted(eventArgs.getDataKeyValue("ContactRecId"));  
        }  
    </script> 
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">  
    <label>Type of contact</label>   
    &nbsp;&nbsp;&nbsp;<telerik:RadComboBox ID="ddlContactTypes" AutoPostBack="true" runat="server"   
        EmptyMessage="Select Contact Type" DataSourceID="LLBLGenProDataSource2" 
        ondatabound="ddlContactTypes_DataBound" DataTextField="ContactType"   
        DataValueField="ContactTypeRecId">  
    </telerik:RadComboBox> 
    <br /> 
    <br /> 
    <div id="TagInstructions" style="width:90%;font-family:Trebuchet MS, Arial, MS Sans Serif; font-size:smaller;color:#666666;">  
        Email Body Tags:<br /> 
        {0} = Quantity Needed, {1} = Product ID, {2} = Available Inventory, {3} = Reserved Amount, {4} = Reorder Point, {5} = Total Inventory<br /> 
        {6} = Product Name, {7} = Ordered by First Name, {8} = Ordered By Last Name, {9} = Order date, {10} = Order ID, {11} = Quantity Multipler</div> 
    <br /> 
 
    <telerik:RadGrid ID="RadGrid1" runat="server" OnItemCreated="RadGrid1_ItemCreated" 
        AllowPaging="True" AllowSorting="True" DataSourceID="LLBLGenProDataSource1"   
        GridLines="None" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"   
        AllowAutomaticUpdates="True" AutoGenerateDeleteColumn="False"   
        MasterTableView-CommandItemDisplay="Top" > 
        <ClientSettings> 
        <ClientEvents OnRowDeleted="RowDeleted"></ClientEvents> 
        </ClientSettings> 
<MasterTableView AutoGenerateColumns="False" DataKeyNames="ContactRecId"  ClientDataKeyNames="ContactRecId" 
            DataSourceID="LLBLGenProDataSource1" EditMode="EditForms" EditFormSettings-ColumnNumber="3" CommandItemSettings-AddNewRecordText="Add new contact">  
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
    <Columns> 
    <telerik:GridEditCommandColumn ItemStyle-Width="20px" ButtonType="LinkButton"></telerik:GridEditCommandColumn> 
        <telerik:GridBoundColumn DataField="ContactRecId" DataType="System.Int32"   
            HeaderText="ContactRecId" ReadOnly="True" Display="false" SortExpression="ContactRecId"   
            UniqueName="ContactRecId">  
        </telerik:GridBoundColumn> 
        <telerik:GridTemplateColumn EditFormColumnIndex="0" EditFormHeaderTextFormat="" Display="false">  
            <EditItemTemplate> 
                <b>Contact Details</b> 
            </EditItemTemplate> 
        </telerik:GridTemplateColumn> 
        <telerik:GridBoundColumn DataField="Name" HeaderText="Name"  ColumnEditorID="txteditor"   
            SortExpression="Name" UniqueName="Name">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Address1" HeaderText="Address 1"  ColumnEditorID="txteditor"   
            SortExpression="Address1" UniqueName="Address1">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Address2" HeaderText="Address 2"  ColumnEditorID="txteditor"   
            SortExpression="Address2" UniqueName="Address2">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Address3" HeaderText="Address 3"  ColumnEditorID="txteditor"   
            SortExpression="Address3" UniqueName="Address3">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="City" HeaderText="City"  ColumnEditorID="txteditor"   
            SortExpression="City" UniqueName="City">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="State" HeaderText="State"  ColumnEditorID="txteditor"   
            SortExpression="State" UniqueName="State">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="PostalCode" HeaderText="Postal Code"  ColumnEditorID="txteditor"   
            SortExpression="PostalCode" UniqueName="PostalCode">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Country" HeaderText="Country"  ColumnEditorID="txteditor"   
            SortExpression="Country" UniqueName="Country">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Phone" HeaderText="Phone"  ColumnEditorID="txteditor"   
            SortExpression="Phone" UniqueName="Phone">  
        </telerik:GridBoundColumn> 
        <telerik:GridTemplateColumn EditFormHeaderTextFormat="" Display="false">  
            <EditItemTemplate> 
                <br /><a href="EditProductEmailTargets2.aspx?c=<%# Eval("ContactRecId") %>">Assign Specific EMail Targets</a> 
            </EditItemTemplate> 
        </telerik:GridTemplateColumn> 
        <telerik:GridTemplateColumn EditFormColumnIndex="1" EditFormHeaderTextFormat="" Display="false">  
            <EditItemTemplate> 
                <b>Below Reorder Point Email</b> 
            </EditItemTemplate> 
        </telerik:GridTemplateColumn> 
        <telerik:GridBoundColumn DataField="ReorderTo" HeaderText="To"   
            SortExpression="ReorderTo" UniqueName="ReorderTo" EditFormColumnIndex="1" ColumnEditorID="txteditor" Display="false">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ReorderCc" HeaderText="CC"   
            SortExpression="ReorderCc" UniqueName="ReorderCc" EditFormColumnIndex="1" ColumnEditorID="txteditor" Display="false">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ReorderBcc" HeaderText="BCC"   
            SortExpression="ReorderBcc" UniqueName="ReorderBcc" EditFormColumnIndex="1" ColumnEditorID="txteditor" Display="false">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ReorderFrom" HeaderText="From"   
            SortExpression="ReorderFrom" UniqueName="ReorderFrom" EditFormColumnIndex="1" ColumnEditorID="txteditor" Display="false">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ReorderSubject" HeaderText="Subject"   
            SortExpression="ReorderSubject" UniqueName="ReorderSubject" EditFormColumnIndex="1" ColumnEditorID="txteditor" Display="false">  
        </telerik:GridBoundColumn> 
        <telerik:GridHTMLEditorColumn HeaderText="Body" DataField="ReorderBody" SortExpression="ReorderBody" UniqueName="ReorderBody" EditFormColumnIndex="1" Display="false"></telerik:GridHTMLEditorColumn> 
        <telerik:GridTemplateColumn Visible="false" ReadOnly="true" HeaderText="Reorder Body" SortExpression="ReorderBody" UniqueName="ReorderBody" EditFormColumnIndex="1" Display="false">  
            <EditItemTemplate> 
            <asp:TextBox ID="txtReorderBody" runat="server" Width="300px" TextMode="MultiLine" Height="150px" Text='<%# Bind("ReorderBody")%>'></asp:TextBox> 
            </EditItemTemplate> 
        </telerik:GridTemplateColumn> 
        <telerik:GridTemplateColumn EditFormColumnIndex="2" EditFormHeaderTextFormat="" Display="false">  
            <EditItemTemplate> 
                <b>Below Zero Inventory Email</b> 
            </EditItemTemplate> 
        </telerik:GridTemplateColumn> 
        <telerik:GridBoundColumn DataField="ZeroInventoryTo" HeaderText="To" ColumnEditorID="txteditor"   
            SortExpression="ZeroInventoryTo" UniqueName="ZeroInventoryTo" EditFormColumnIndex="2" Display="false">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ZeroInventoryCc" HeaderText="CC"  ColumnEditorID="txteditor" 
            SortExpression="ZeroInventoryCc" UniqueName="ZeroInventoryCc" EditFormColumnIndex="2" Display="false">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ZeroInventoryBcc" HeaderText="BCC"  ColumnEditorID="txteditor" 
            SortExpression="ZeroInventoryBcc" UniqueName="ZeroInventoryBcc" EditFormColumnIndex="2" Display="false">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ZeroInventoryFrom" HeaderText="From"  ColumnEditorID="txteditor" 
            SortExpression="ZeroInventoryFrom" UniqueName="ZeroInventoryFrom" EditFormColumnIndex="2" Display="false">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ZeroInventorySubject" HeaderText="Subject"  ColumnEditorID="txteditor" 
            SortExpression="ZeroInventorySubject" UniqueName="ZeroInventorySubject" EditFormColumnIndex="2" Display="false">  
        </telerik:GridBoundColumn> 
          
        <telerik:GridHTMLEditorColumn HeaderText="Body" DataField="ZeroInventoryBody" ColumnEditorID="htmleditor1"  SortExpression="ZeroInventoryBody" UniqueName="ZeroInventoryBody" EditFormColumnIndex="2" Display="false"></telerik:GridHTMLEditorColumn> 
          
        <telerik:GridClientDeleteColumn ItemStyle-Width="20px" ConfirmText="Are you sure you want to delete this contact?" HeaderStyle-Width="35px" ButtonType="ImageButton" /> 
    </Columns> 
 
<EditFormSettings> 
<EditColumn UniqueName="EditCommandColumn1"></EditColumn> 
</EditFormSettings> 
</MasterTableView> 
    </telerik:RadGrid> 
          
    <telerik:GridTextBoxColumnEditor ID="txteditor" runat="server" TextBoxStyle-Width="300px"></telerik:GridTextBoxColumnEditor> 
      
    </telerik:RadAjaxPanel> 
    <llblgenpro:LLBLGenProDataSource ID="LLBLGenProDataSource1" runat="server"   
        DataContainerType="EntityCollection"   
          
        EntityCollectionTypeName="AFPI.Inventory.DAL.CollectionClasses.ContactCollection, AFPI.Inventory.DAL">  
        <InsertParameters> 
            <asp:ControlParameter ControlID="ddlContactTypes" Name="ContactTypeRecId"   
                PropertyName="SelectedValue" /> 
        </InsertParameters> 
        <SelectParameters> 
            <asp:ControlParameter ControlID="ddlContactTypes" DefaultValue=""   
                Name="ContactTypeRecId" PropertyName="SelectedValue" /> 
            <asp:Parameter DefaultValue="" Name="DeletedDate" ConvertEmptyStringToNull="true" /> 
        </SelectParameters> 
        <UpdateParameters> 
            <asp:ControlParameter ControlID="ddlContactTypes" Name="ContactTypeRecId"   
                PropertyName="SelectedValue" /> 
        </UpdateParameters> 
    </llblgenpro:LLBLGenProDataSource> 
      
      
    <llblgenpro:LLBLGenProDataSource ID="LLBLGenProDataSource2" runat="server"   
        DataContainerType="EntityCollection"   
        EntityCollectionTypeName="AFPI.Inventory.DAL.CollectionClasses.ContactTypeCollection, AFPI.Inventory.DAL">  
          
    </llblgenpro:LLBLGenProDataSource> 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">  
    </telerik:RadAjaxLoadingPanel> 
Code Behind
protected void ddlContactTypes_DataBound(object sender, EventArgs e)  
        {  
            ddlContactTypes.Items.Remove(1);  
            if (Request.QueryString["ct"] != null)  
            {  
 
                if (ddlContactTypes.Items.FindItemByValue(Request.QueryString["ct"].ToString()) != null)  
                {  
                    ddlContactTypes.Items.FindItemByValue(Request.QueryString["ct"].ToString()).Selected = true;  
                }  
            }  
        }  
 
        protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
        {  
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
            {  
                GridEditableItem item = (GridEditableItem)e.Item;  
                RadEditor ReorderBody = (RadEditor)item["ReorderBody"].Controls[0];  
                ReorderBody.Height = Unit.Pixel(200);  
                ReorderBody.Width = Unit.Pixel(300);  
                ReorderBody.AutoResizeHeight = false;  
 
 
                RadEditor ZeroInventoryBody = (RadEditor)item["ZeroInventoryBody"].Controls[0];  
                ZeroInventoryBody.Height = Unit.Pixel(200);  
                ZeroInventoryBody.Width = Unit.Pixel(300);  
                ZeroInventoryBody.AutoResizeHeight = false;  
            }  
        }    
 
 
        [WebMethod]  
        public static void MarkRecordDeleted(int RecId)  
        {  
            Guid? userGuid = UserUtil.getCurrentUserGuid(Membership.GetUser());  
 
            ContactEntity ent = new ContactEntity(RecId);  
            ent.DeletedBy = userGuid;  
            ent.DeletedDate = DateTime.Now;  
            ent.Save();  
        } 

This is the only page it happens on.  I don't see where I'm adding a control after PreRender either?

Thanks,

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 02 Jul 2010, 09:26 AM
Hello MGrassman,

I examined your code but I am not able to find anything peculiar in the implementation which might cause this exception to appear. To progress in our investigation, I would offer you to isolate a stripped working version of your project and send it enclosed to a regular support ticket. We will debug it locally and will get back to you with our findings.

You may also perform a quick test replacing the LLBLGenProDataSource controls with asp ObjectDataSources temporary to see whether this makes a difference (although I doubt that the data sources may be the cause of the issue here).

Kind regards,
Sebastian
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
MGrassman
Top achievements
Rank 2
Answers by
Sebastian
Telerik team
Share this question
or