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

Form Decorator causing Render error

1 Answer 54 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
MGrassman
Top achievements
Rank 2
MGrassman asked on 22 Sep 2010, 03:53 AM
Error Message: Script controls may not be registered after PreRender.

When I include 
<telerik:RadFormDecorator ID="rfd" runat="server" DecoratedControls="All" 
        EnableRoundedCorners="False"  />
I get this error when I remove it everything works fine.

I have other pages that work just fine and they are setup the same.  When I remove all columns of the grid everything works fine.  I have removed the code behind and left the columns and the error still persists.  When I remove the datasource everything works fine but then there are no columns which caused me to remove all the columns and see if this is the issue.

Not sure what is going on when the form decorator is on this page.

EDIT: This only happened when I upgraded to the latest version of RadConrols the previous version worked fine.

Any suggestions?

Here is my Page
<%@ Page Language="C#"  AutoEventWireup="true" CodeBehind="EditContacts.aspx.cs" Inherits="AFPI.Inventory.Web.EditContacts" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head id="Head1" runat="server">
    <title>Inventory Admin</title>
    <telerik:RadStyleSheetManager id="rssm" runat="server" OutputCompression="Forced" />
    <script type="text/javascript" language="javascript">
        function RowDeleted(sender, eventArgs) {
            PageMethods.MarkRecordDeleted(eventArgs.getDataKeyValue("ContactRecId"));
        }
    </script>
</head>
<form id="form1" runat="server">
    <telerik:RadScriptManager ID="rsm" runat="server" EnablePageMethods="true"
        EnableHistory="True"
        EnableScriptLocalization="False" OutputCompression="Forced"
        ScriptMode="Release">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Path="~/Resources/JS/jquery.cookie.js" />
            <asp:ScriptReference Path="~/Resources/JS/Globals.js" />
        </Scripts>
        <Services>
            <asp:ServiceReference Path="~/WebService/Ledger.asmx" />
        </Services>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        window.$ = $telerik.$;
    </script>
    <telerik:RadFormDecorator ID="rfd" runat="server" DecoratedControls="All"
        EnableRoundedCorners="False"  />
    <telerik:RadSkinManager ID="rsknm" runat="server" Skin="WebBlue" />
    <telerik:RadAjaxManager ID="ram" runat="server" />
     
     
    <div>
        <div style="background-color:#577486; width:100%; border:solid 1px #577486; margin-bottom:2px;">
        <asp:Image ID="imgHeader" style="float:left;" runat="server" ImageUrl="~/Resources/Images/HeaderLogo.png" />
        <div style="float:Right; width:300px;font-size:30px;color:White; font-weight:bold; text-transform:capitalize; vertical-align:middle; line-height:55px; margin-right:50px;">Inventory Management</div>
        <div style="clear:both;"></div>
        </div>
         
        <telerik:RadMenu style="z-index:600" Width="100%" ID="RadMenu1" runat="server" DataNavigateUrlField="Url"
            DataSourceID="SiteMapDataSource1" DataTextField="Title" >
             
            </telerik:RadMenu>
        <div style="clear:both;"></div>
        <h4>
            <asp:SiteMapPath ID="SiteMapPath1" runat="server" Font-Names="Verdana"  ParentLevelsDisplayed="0"
                Font-Size="0.8em" PathSeparator=" : ">
                <PathSeparatorStyle Font-Bold="True" ForeColor="#5D7B9D" />
                <CurrentNodeStyle ForeColor="#333333" />
                <NodeStyle Font-Bold="True" ForeColor="#7C6F57" />
                <RootNodeStyle Font-Bold="True" ForeColor="#5D7B9D" />
                 
            </asp:SiteMapPath>
        </h4>
     
    <label>Type of contact</label>
       <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>
     
     
    <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>
     
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" SiteMapProvider="secureProvider" ShowStartingNode="false" />
    </div>
    </form>
</body>
</html>

Here is my Code behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Web.Services;
using AFPI.Inventory.DAL.EntityClasses;
using System.Web.Security;
using AFPI.Inventory.BAL;
namespace AFPI.Inventory.Web
{
    public partial class EditContacts : System.Web.UI.Page
    {
        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();
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 24 Sep 2010, 12:08 PM
Hi,

We tried to reproduce the problem with the provided information, but after removing the parts of the code that we were not able to run, everything worked as expected. To be able to help, we will need to get a better view over your exact scenario. Please open a support ticket and send us a sample project (make sure that it can be run locally) and we will check it right away.



Kind regards,
Georgi Tunev
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
FormDecorator
Asked by
MGrassman
Top achievements
Rank 2
Answers by
Georgi Tunev
Telerik team
Share this question
or