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

Hide Size Column In Image Managers RadFileExplorer

4 Answers 177 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 1
Phil asked on 17 Dec 2010, 01:32 PM
Hi

I wanted to remove the Size column from the built in Media/Flash/Image Manager dialogs in the editor but on reading this posting it appears that the only solution is to hide it.

I have already customised the built in dialogs by extracting their .ascx files to a folder in my solution and from what I can see it appears that the FileBrowser.ascx is the file that i need to change.  The above posting suggests that I need to use the code below to hide the Size column.  What I cannot determine however is how to hook up this code.  There is no codebehind for fileBrowser.ascx and despite adding an inline Page_Load event to the fileBrowsers.ascx markup I cannot seem to tap into the page load event which would allow me to use the code below

GridColumn SizeColumn = RadFileExplorer1.Grid.Columns.FindByUniqueNameSafe("Size");
SizeColumn.ItemStyle.Width = Unit.Pixel(1);
SizeColumn.HeaderStyle.Width = Unit.Pixel(1);

Any suggestions on how I can achieve this ?

thanks in advance

4 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 20 Dec 2010, 08:36 AM
Hello Stephen,

The following KB article shows how to get a reference to the Grid control in the FileBrowser dialog of RadEditor using the FindRadControl function: Displaying single upload control in the FileBrowser Upload manager.

Best regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Phil
Top achievements
Rank 1
answered on 20 Dec 2010, 11:48 AM
Hi Rumen

Thanks once again this worked perfectly.

Registering my own custom control (FileBrowser_Extension.ascx) on the FileBrowser.ascx control and then tapping into its page_load event I was able to hide the Size column in the RadFileExplorer.  Also for anyone reading this thread in future I was able to use VB code (which the rest of my project is built in) in my custom control rather than C# should you need to do something silimar - full code for my "FileBrowser_Extension.ascx" control below :

<%@ Control Language="vb" AutoEventWireup="true" CodeBehind="FileBrowser_Extension.ascx.vb" Inherits="FileBrowser_Extension" %>
<script runat="server" type="text/VB">
    Protected Sub Page_Load(ByVal sender As Object, ByVal args As System.EventArgs) Handles Me.Load
        Dim rfe As Telerik.Web.UI.RadFileExplorer = DirectCast(Me.FindRadControl(Me.Page), Telerik.Web.UI.RadFileExplorer)
        If rfe IsNot Nothing Then
            Dim GC As Telerik.Web.UI.GridColumn = rfe.Grid.Columns.FindByUniqueNameSafe("Size")
            If Not GC Is Nothing Then
                GC.ItemStyle.Width = Unit.Pixel(1)
                GC.HeaderStyle.Width = Unit.Pixel(1)
            End If
        End If
    End Sub
 
    Private Function FindRadControl(ByVal parent As Control) As Control
        For Each c As Control In parent.Controls
 
            If TypeOf c Is Telerik.Web.UI.RadFileExplorer Then
                Return c
            End If
            If c.Controls.Count > 0 Then
                Dim [sub] As Control = FindRadControl(c)
                If [sub] IsNot Nothing Then
                    Return [sub]
                End If
            End If
        Next
        Return Nothing
    End Function
 
</script>


Cheers
0
vamshi
Top achievements
Rank 1
answered on 05 Jan 2011, 08:42 AM
The code given does really work. If i keep the same code in FileBrowser.ascx it does not give the intended result. when i have written the same code in another user control and when we register that user control in Filebrowser.ascx it works fine. I just want to know why this does not work when we keep the same code in Filebrowser.ascx directly.

Regards,
vamshi.
0
Rumen
Telerik team
answered on 06 Jan 2011, 03:34 PM
Hi Vamshi,

The files in the EditorDialogs folder are not standard UserControls files and theirs codebehind is embedded in the Telerik.Web.UI.dll. The content and structure of these external files is very close to these one of usercontrols and to be associated to and opened by Visual Studio we have set their extensions to be ascx. However, these files could not execute server code and for that reason you should use an external user control.


Best regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Editor
Asked by
Phil
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Phil
Top achievements
Rank 1
vamshi
Top achievements
Rank 1
Share this question
or