Multiple Control Methodology + RadEditor not working

Thread is closed for posting
3 posts, 0 answers
  1. Doug Odegaard
    Doug Odegaard avatar
    52 posts
    Member since:
    Oct 2004

    Posted 25 Mar 2009 Link to this post

    OK....I'm sure you'll think I'm going overboard but I am trying to add three different controls to a View and am finding strange behaviour.  But I think the fatal flaw is probably my understanding of when to use <form runat="server"> tags, ScriptManagers, etc.  So here is where I need help.....

    1.  Can anyone throw me a bone on why this view works without the RadEditor on it but once I copy it back in the RadFileExplorer ceases working?  Run the view without the RadEditor and then with to see the difference.
    2. Would Telerik be willing to write some blog posts helping with the methodology for adding these more complex control that are not part of the MVC demo.  Of greatest interest is an app that persists data rather than just rendering.  I can only think these posts will be worth hundreds of support hours you might need to provide users like me.  Thanks in advance and I will post things in the forum to help.

    Here is my view.....

    <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ThemeInfo>" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">  
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">  
        <h2>Theme Details</h2> 
            <label for="LeadId">Theme Name:</label> 
            <%= Html.TextBox("Name") %> 
            <%= Html.ValidationMessage("Name", "*") %> 
            <%=Html.ActionLink("Download Theme", "Download") %> 
                <legend>Replace Theme</legend> 
                    <label for="Email">Theme Zip Upload:</label> 
                            Allowed files: .zip archives (limitation set in .aspx):  
                    <% using (Html.BeginForm("Upload", "Themes", FormMethod.Post, new { enctype="multipart/form-data"})){%> 
                    <telerik:RadUpload runat="server" ID="RadUpload1" initialfileinputscount="1"   
                    <telerik:RadProgressManager runat="server" ID="RadProgressManager1" AjaxUrl="~/Telerik.RadUploadProgressHandler.axd"/>  
                        <telerik:RadProgressArea runat="server" ID="RadProgressArea1"/>  
                    <input type="submit" value="Upload" /> 
                    <%} %>    
                    editorCode.Content = "TODO Put in js to set to file contents";  
                    <label for="ContactForm">Code View:</label> 
                    <telerik:RadEditor ID="editorCode" Runat="server" DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd"  > 
            <form id="Form1" runat="server">  
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
                    <telerik:RadFileExplorer runat="server" ID="FileExplorer1" Skin="Vista" Width="450" VisibleControls="Grid,TreeView,Toolbar"   
                        OnClientCreateNewFolder="OnClientCreateNewFolder" OnClientDelete="OnClientDelete" 
                        OnClientFileOpen="OnClientFileOpen" OnClientFolderChange="OnClientFolderChange" 
                        OnClientFolderLoaded="OnClientFolderLoaded" OnClientItemSelected="OnClientItemSelected" 
                        OnClientLoad="OnClientLoad" OnClientMove="OnClientMove" EnableOpenFile="true" > 
                        <Configuration ViewPaths="~/Content" UploadPaths="~/Content" 
                            DeletePaths="~/Content" /> 
                    <div id="eventConsole" class="module" style="height: 470px; width: 300px; overflow: auto;">  
            <script type="text/javascript">  
                function OnClientFolderLoaded(sender, args) {  
                    LogEvent("Grid folder loaded: " + args.get_item().get_name());  
                function OnClientFileOpen(sender, args) {  
                    LogEvent("Item open: " + args.get_item().get_name());  
                function OnClientItemSelected(sender, args) {  
                    LogEvent("Item click: " + args.get_item().get_name());  
                function OnClientFolderChange(sender, args) {  
                    LogEvent("Tree folder change: " + args.get_item().get_name());  
                function OnClientDelete(sender, args) {  
                    LogEvent("Delete: " + args.get_item().get_name());  
                function OnClientCreateNewFolder(sender, args) {  
                    LogEvent("Create new folder: " + args.get_newPath());  
                function OnClientMove(sender, args) {  
                    LogEvent("Item moved to: " + args.get_newPath());  
                function OnClientLoad(sender, args) {  
                    LogEvent("File Explorer loaded!");  
                function LogEvent(text) {  
                    var d = new Date();  
                    var ddateStr = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + "." + d.getMilliseconds();  
                    var eventConsole = $get("eventConsole");  
                    eventConsole.innerHTML += "[" + dateStr + "] " + text + "<br/>";  
            <%=Html.ActionLink("Edit", "Edit", new { /* id=Model.PrimaryKey */ }) %> |  
            <%=Html.ActionLink("Back to List", "Index") %> 
  2. Doug Odegaard
    Doug Odegaard avatar
    52 posts
    Member since:
    Oct 2004

    Posted 25 Mar 2009 Link to this post

    Let me add an extra detail....I have found that anytime anything is added after the RFE it will cease functioning.  So it might not have anything to do with the RadEditor but instead placement after the RFE.
  3. Lini
    Lini avatar
    2144 posts

    Posted 30 Mar 2009 Link to this post

    Hello Doug,

    I am not sure what the problem is in this case. We will do some tests and see if we can track down the JavaScript exception. I ran your code and got an "Invalid Argument" exception when the file explorer tried to make its callback requests to populate the tree and grid controls.

    For best results in MVC, try using only one form and put all controls that will be making AJAX requests to the server in it (in this case the upload + progress area, file explorer and editor).

    All the best,
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Back to Top