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

RadEditor Q2 2008

10 Answers 122 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Vaibhav
Top achievements
Rank 1
Vaibhav asked on 29 Sep 2008, 11:12 AM
I need to set editor's content to some value on page_load from client script.
<body onload="SetButtons();" >
    <form id="form1" runat="server">
....
....

Iin SetButtons :

<script language = "javascript">

function SetButtons ()
{
var editor = <%=radEditContent.ClientID %>;
    var oArg = window.opener.GetCreativeContent();
    editor.SetHtml(oArg);
}

</script>

This works fine with Q3 2007 controls. I can't reproduce this functionalityin Q2 2008 controls.
Issues I am facing are

- var editor = $find("<%=radEditContent.ClientID%>")

in this case editor is null

or
- set_html is not recognized

Some time I get editor but set_html is not working

Any help on this please.

10 Answers, 1 is accepted

Sort by
0
Accepted
George
Telerik team
answered on 30 Sep 2008, 01:30 PM
Hi Vaibhav,

Please review the following help articles that describe how to achieve the desired behavior:
I hope this helps.

Sincerely,
George
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mohammad
Top achievements
Rank 1
answered on 30 Sep 2008, 01:44 PM
i faced this problem too  everytime the reference in Javascript comes null
0
Rumen
Telerik team
answered on 30 Sep 2008, 03:25 PM
Hi Mohammad,

RadEditor for ASP.NET AJAX is created just as the last code on the page in the Sys.Application.init MS AJAX event, which is raised after the window.onload event. That is why if you put your js code which tries to obtain a reference to RadEditor in the head tag, then the editor will be not yet created and the reference to the editor will return undefined.

This information is available in the following help article: Getting a Reference to RadEditor.


If you experience any problems, please open a support ticket and send a sample working project that demonstrates them. We will examine them and will provide guidance how to solve the issues.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Vaibhav
Top achievements
Rank 1
answered on 01 Oct 2008, 05:42 AM
Hi George,

Thank you.

Code worked when I put my function inside Sys.Application.add_load block

Sample code that works fine is:
 
<script type="text/javascript">
Sys.Application.add_load
(
 
function SetButtons ()
  {
     var editor = $find("<%=radEditContent.ClientID%>"); 
     var oArg = window.opener.GetCreativeContent();
     editor.set_html(oArg);
  }

);
</script>
0
Mohammad
Top achievements
Rank 1
answered on 05 Oct 2008, 08:00 AM
it still doesn't work with me here is the code that i worteSys.Application.add_load(function()$0$0  {$0$0     var editor = $find("<%=_txtSteps.ClientID%>"); //get a reference to RadEditor client object$0$0     alert(editor.get_id()); //returns RadEditor Client ID$0$0  }$0$0);$0$0$0$0$0it also return null $0$0$0$0$0$0$0$0$0i worte it in a user control not in the page itself$0
0
Rumen
Telerik team
answered on 06 Oct 2008, 07:29 AM
Hi Mohammad,

If RadEditor with ID="RadEditor1" is defined in a user control with ID = "WebUserControl1" you can access it with the following code:

        <uc1:WebUserControl ID="WebUserControl1" runat="server" />
       
        <script type="text/javascript">
        Sys.Application.add_load
        (
        
        function()
          {
             var editor = $find("WebUserControl1_RadEditor1");
             alert(editor.get_id());
            
          }
        );
        </script>

Another way to get a reference on the client to all telerik controls on the page is to use the $telerik.radControls array, e.g.

var telerikArray = $telerik.radControls; //returns a reference to all telerik controls on the page
for (i=0;i<telerikArray.length;i++)
{
    alert(telerikArray[i].get_id());
}


Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ahmed Soliman
Top achievements
Rank 1
answered on 06 Oct 2008, 08:22 AM
i tried what you sent and nothing happened$0i would like to tell you that i put the rad editor in a user control which is placed in anther user control.$0$0second , when i used  $telerik.radControls , the ids of the rad editors didn't appear , although other controls (like RadNumericTextBox Q1) appeared.$0$0Here is the HTML of the user control To Check it $0$0Please , i need it urgent $0$0$0$0$0$0<table width="100%" onload="Page_Load">$0$0    <tr>$0$0        <td width="100%" colspan="6">$0$0            <telerik:RadToolBar ID="_RadToolBar" runat="server" Skin="Office2007" Orientation="Horizontal"$0$0                Style="display: block; float: none;" DisplayEnds="false" UseEmbeddedScripts="True"$0$0                Width="100%" AutoPostBack="true" OnButtonClick="TestCaseToolBarButtonClick" OnPreRender="_RadToolBarPreRender">$0$0                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>$0$0                <Items>$0$0                    <telerik:RadToolBarButton runat="server" Value="Delete" ImageUrl="~/Images/delete.png"$0$0                        ToolTip="Delete" CommandName="Delete" CausesValidation="false">$0$0                    </telerik:RadToolBarButton>$0$0                    <telerik:RadToolBarButton runat="server" Value="New" ToolTip="Add New" ImageUrl="~/Images/add.png"$0$0                        CommandName="New" CausesValidation="false" onclick="SetNewTCID(-1)">$0$0                    </telerik:RadToolBarButton>$0$0                    <telerik:RadToolBarButton runat="server" Value="Save" ToolTip="Save" ImageUrl="~/Images/disk.png" $0$0                        CommandName="Save" onclick="OnPreSave();"  >$0$0                    </telerik:RadToolBarButton>$0$0                    <telerik:RadToolBarButton id="_sperator1" runat="server" IsSeparator="true">$0$0                    </telerik:RadToolBarButton>$0$0                    <telerik:RadToolBarButton id="ReviewersAssignmentWindow" Value="Reviewers" CommandName="Reviewers"$0$0                        CausesValidation="false" runat="server" ToolTip="Assign Reviewers" ImageUrl="~/Images/user_suit.png"$0$0                        PostBack="false" onclick="OnReviewers()">$0$0                    </telerik:RadToolBarButton>$0$0                    <telerik:RadToolBarButton id="attachwindow" Value="Attachment" CommandName="Attachment"$0$0                        CausesValidation="false" runat="server" ToolTip="Attachment" ImageUrl="~/Images/attach.png"$0$0                        PostBack="false" onclick="OpenAttachmentWindow()">$0$0                    </telerik:RadToolBarButton>$0$0                    <telerik:RadToolBarButton id="CopyTestCase" Value="CopyTestCase" CommandName="CopyTestCase"$0$0                        CausesValidation="false" runat="server" ToolTip="Copy TestCase" ImageUrl="~/Images/copy.png"$0$0                        />$0$0                        <telerik:RadToolBarButton id="AddDefect" Value="AddDefect" CommandName="AddDefect"$0$0                        CausesValidation="false" runat="server" ToolTip="Add Defect" ImageUrl="~/Images/bug.png"$0$0                        PostBack="false" onclick="OpenDefectWindow()"$0$0                        >$0$0                    </telerik:RadToolBarButton>$0$0                </Items>$0$0            </telerik:RadToolBar>$0$0        </td>$0$0    </tr>$0$0    <tr>$0$0        <td colspan="6">$0$0            <asp:ValidationSummary ID="_ValSum" runat="server" CssClass="validationSum" />$0$0        </td>$0$0    </tr>$0$0    <tr>$0$0        <td align="center" colspan="6">$0$0            <asp:Label ID="lblMessage" runat="server" ForeColor="Red" EnableViewState="false"></asp:Label>$0$0        </td>$0$0    </tr>$0$0    <tr>$0$0        <td width="10%">$0$0            <span class="label">Name:</span>$0$0            $0$0        </td>$0$0        <td width="20%">$0$0            <asp:TextBox ID="_txtName" runat="server" onchange="OnControlChanged()" ></asp:TextBox>$0$0            <asp:RequiredFieldValidator ID="reqName" runat="server" ControlToValidate="_txtName" Text="*" ErrorMessage="Name is Required"></asp:RequiredFieldValidator>$0$0        </td>$0$0        <td width="10%">$0$0        <span  class="label" >Requirement:</span>$0$0        </td>$0$0        <td>$0$0            <telerik:RadNumericTextBox ID="_txtRequirementID" onchange="OnControlChanged()"  runat="server"></telerik:RadNumericTextBox>$0$0        </td>$0$0    </tr>$0$0    <tr>$0$0        <td>$0$0            <span class="label">Module:</span>$0$0        </td>$0$0        <td>$0$0            <asp:DropDownList ID="_drpModuleID"  onchange="OnControlChanged()" runat="server" AppendDataBoundItems="true">$0$0            <asp:ListItem Text="- Select Module -" Value="-1"></asp:ListItem>$0$0            </asp:DropDownList>$0$0            <asp:RequiredFieldValidator ID="reqModule" runat="server" ErrorMessage="Module is required" Text="*" ControlToValidate="_drpModuleID" InitialValue="-1"></asp:RequiredFieldValidator>$0$0        </td>$0$0        <td>$0$0        <span class="label" >Project Release:</span>$0$0        </td>$0$0        <td>$0$0            <asp:DropDownList ID="_drpProjectReleaseID" onchange="OnControlChanged()"  runat="server" AppendDataBoundItems="true">$0$0            <asp:ListItem Text="- Select Release -" Value="-1"></asp:ListItem>$0$0            </asp:DropDownList>$0$0            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Release is required" Text="*" ControlToValidate="_drpProjectReleaseID" InitialValue="-1"></asp:RequiredFieldValidator>$0$0        </td>$0$0        $0$0    </tr>$0$0    <tr>$0$0        <td>$0$0            <span class="label">Complexity</span>$0$0        </td>$0$0        <td>$0$0            <asp:DropDownList ID="_drpComplexity" onchange="OnControlChanged()" runat="server" AppendDataBoundItems="true">$0$0            <asp:ListItem Text="- Select Complexity -" Value="-1"></asp:ListItem>$0$0            </asp:DropDownList>$0$0            <asp:RequiredFieldValidator ID="reqComplexity" runat="server" InitialValue="-1" ControlToValidate="_drpComplexity" Text="*" ErrorMessage="Complexity is required"></asp:RequiredFieldValidator>$0$0        </td>$0$0        <td>$0$0            <span class="label">Approved</span>$0$0        </td>$0$0        <td>$0$0      $0$0            <asp:CheckBox ID="_chkApproved" onclick="OnControlChanged()"   runat="server" />$0$0            $0$0        </td>$0$0    </tr>$0$0    <tr>$0$0        <td><span class="label">Status:</span></td>$0$0        <td>$0$0            <asp:DropDownList ID="_drpStatus" onchange="OnControlChanged()" runat="server" AppendDataBoundItems="true">$0$0                <asp:ListItem Text="- Select Status -" Value="-1"></asp:ListItem>$0$0            </asp:DropDownList>$0$0        </td>$0$0         <td>$0$0            <span class="label">Critical Path</span>$0$0        </td>$0$0        <td>$0$0      $0$0            <asp:CheckBox ID="_chkCriticalPath" onclick="OnControlChanged()"   runat="server" />$0$0        </td>$0$0        <td>$0$0            <span class="label">Last ReApproval Reason</span>$0$0        </td>$0$0        <td><asp:Label ID="lblLastReason" runat='server'></asp:Label></td>$0$0    </tr>$0$0    <tr>$0$0        <td>$0$0            <span class="label">Steps</span>$0$0        </td>$0$0        <td colspan="5">$0$0        <table>$0$0            <tr>$0$0                <td>$0$0                    <rad:RadEditor ID="_txtSteps" runat="server"> $0$0                        $0$0                    </rad:RadEditor>$0$0                </td>$0$0            <td><asp:RequiredFieldValidator ID="reqSteps" runat="server" ControlToValidate="_txtSteps" Text="*" ErrorMessage="Steps are required"></asp:RequiredFieldValidator></td>$0$0        </tr>$0$0        </table>$0$0            $0$0            $0$0        </td>$0$0    </tr>$0$0    <tr>$0$0        <td>$0$0            <span class="label">Expected</span>$0$0        </td>$0$0        <td colspan="5">$0$0        <table>$0$0            <tr>$0$0             <rad:RadEditor ID="_txtExpected" runat="server" ToolbarMode="ShowOnFocus" $0$0                    Skin="Office2007" Editable="true" ToolsWidth="330px" Width="400"$0$0                    Height="200px" ToolsFile="" SaveInFile="False" >$0$0                    </rad:RadEditor>$0$0                <td> $0$0                </td>$0$0                <td><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="_txtExpected" Text="*" ErrorMessage="Expected are required"></asp:RequiredFieldValidator></td>$0$0            </tr>$0$0        </table>$0$0           $0$0        </td>$0$0    </tr>$0$0    $0$0</table>$0$0$0$0$0$0$0$0$0$0$0
0
Mohammad
Top achievements
Rank 1
answered on 06 Oct 2008, 11:46 AM
i made a workaround and it worked 

    <rad:RadEditor ID="_txtSteps" runat="server" ToolbarMode="ShowOnFocus" 
                        Skin="Office2007" Editable="true" ToolsWidth="330px" Width="400"
                    Height="200px" ShowHtmlMode="false" ShowSubmitCancelButtons="false" ShowPreviewMode="false"
                         SaveInFile="False" OnClientLoad="OnStepsLoad"> 
                        
                    </rad:RadEditor>

i used  OnClientLoad="OnStepsLoad" to store a reference to the editor once it loaded

  var steps;
    function OnStepsLoad(editor) {

        steps = editor;
    }
0
Vaibhav
Top achievements
Rank 1
answered on 07 Oct 2008, 06:09 AM
Hi,

Which version have you used?
<rad:RadEditor...> looks to be older version...

New version uses <telerik:......>

Please correct me if wrong.

Vaibhav

0
Mohammad
Top achievements
Rank 1
answered on 07 Oct 2008, 07:47 AM
No i am using 2008 Q2 version.
Tags
Editor
Asked by
Vaibhav
Top achievements
Rank 1
Answers by
George
Telerik team
Mohammad
Top achievements
Rank 1
Rumen
Telerik team
Vaibhav
Top achievements
Rank 1
Ahmed Soliman
Top achievements
Rank 1
Share this question
or