Using MediaManager within custom control but hide it from the default toolbar

2 posts, 0 answers
  1. Mark
    Mark avatar
    15 posts
    Member since:
    Jul 2013

    Posted 22 Nov 2013 Link to this post


    we have our own custom control to insert flash and video into the website. Within the control we are using the media manager to let the user choose the files.
    The problem we have is that we want to hide the media manager icon from the default toolbar but still be able to open the media manager from within our custom control.
    If we remove the mediamanager entry in the ToolFile.xml the media manager also won't open in our custom control.
    If we leave it there it works, but the default media manager icon is still present.

    Is there any possibility to just hide the default media manager icon?


  2. Ianko
    Ianko avatar
    1956 posts

    Posted 27 Nov 2013 Link to this post

    Hi Mark,

    The described behavior occurs because of optimization matters. When a dialog tool is not defined in the toolbar, its Dialog Definitions are not being registered.

    To workaround this issue and use the desired dialog only in the custom dialogs you could set the Visibility property of the tool to false, so that it appears defined in the toolbar, but it would be not visible to the user.

    Please follow either of these approaches to achieve the desired functionality:
    • If the tool is set in the editor's markup you could use the Visible property of the tool:
      <telerik:RadEditor runat="server" ID="RadEditor1">
                  <telerik:EditorTool Name="MediaManager" Visible="false" />
    • In case that the tool is set in the ToolsFile.xml file you could use JavaScript, C# or VB approach:

      JavaScript example:
      <telerik:RadEditor runat="server" ID="RadEditor1"
          ToolsFile="ToolsFile.xml" OnClientLoad="OnClientLoad">
      <script type="text/javascript">
          function OnClientLoad(editor, args) {
              var toolAdapter = editor.get_toolAdapter();
              var mediaTool = toolAdapter.getToolByName("MediaManager");

      C# example:
      protected void Page_Load(object sender, EventArgs e)
          EditorToolGroupCollection tools = RadEditor1.Tools;
          string toolName = "MediaManager";
          for (int i = 0; i < tools.Count; i++)
              if (tools[i].Contains(toolName))
                  EditorTool mediaTool = tools[i].FindTool(toolName);
                  mediaTool.Visible = false;

      VB example:
      Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
          Dim tools As EditorToolGroupCollection = RadEditor1.Tools
          Dim toolName As String = "MediaManager"
          For Each toolGroup As EditorToolGroup In tools
              If toolGroup.Contains(toolName) Then
                  Dim tool As EditorTool = toolGroup.FindTool(toolName)
                  tool.Visible = False
              End If
      End Sub

    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top