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

Height incorrect when using OnClientLoad with RadAjaxManager

0 Answers 78 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 02 Dec 2010, 04:46 PM
RESOLVED: See notes blow.

Dynamically adding a RadEditor to the page and then calling set_mode() in the OnClientLoad event causes RadEditor to render abnormally.

I've attached a screenshot of this behavior. Here is the code to reproduce the issue:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
 
<%@ Register Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" TagPrefix="telerik" %>
 
<script runat="server" language="vbscript">
    Protected Sub btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Click
        Dim div As New HtmlGenericControl("div")
        div.Style("height") = "300px"
        div.Style("border") = "1px solid #f00"
 
        Dim edt As New RadEditor()
        edt.Height = Unit.Pixel(300)
        edt.OnClientLoad = "function(editor,args){ editor.set_mode(1); }"
        div.Controls.Add(edt)
        pnl.Controls.Add(div)
    End Sub
</script>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager runat="server" />
    <asp:Panel runat="server" ID="pnl">
        <asp:Button runat="server" ID="btn" Text="Load Controls" />
    </asp:Panel>
    <telerik:RadAjaxManager runat="server" DefaultLoadingPanelID="loading">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="pnl">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnl" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="loading">
        Loading...
    </telerik:RadAjaxLoadingPanel>
    </form>
</body>
</html>

Steps:
1. Click "Load Controls" button

Expected result:
RadEditor added to page with 300px height

Actual result:
RadEditor added to page with very large height

Notes:
Issue only occurs the first time "Load Controls" button is pressed. Subsequently pressing "Load Controls" will produce the expected results.

Browser: Firefox 3.6.12
Telerik version 2009.3.1314.35

------------------------------------------------------------------

Solution

I was able to resolve this issue by adding a slight delay...

setTimeout(function() { editor.set_mode(1); }, 100);

No answers yet. Maybe you can help?

Tags
Editor
Asked by
Kevin
Top achievements
Rank 1
Share this question
or