More in this section

Forums / Developing with Sitefinity / File Size display in bytes or KB or MB in RadFileExplorer telerik Grid control

File Size display in bytes or KB or MB in RadFileExplorer telerik Grid control

4 posts, 0 answered
  1. vikas
    vikas avatar
    3 posts
    Registered:
    10 Jul 2012
    07 Apr 2009
    Link to this post
    Hi

      I want to display uploaded file size in RadFileExplorer Grid like as 6168 bytes or in KB or MB.

    How It will be possible?

    Please help me.

    Regards
    vikas goel
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Apr 2009
    Link to this post
    Hi vikas,

    The size of the files is shown by default. check out the online demo at http://demos.telerik.com/aspnet-ajax/fileexplorer/examples/dbfilebrowsercontentprovider/defaultcs.aspx and the attached screenshot.

    Just to let you know in accordance to our support terms you need to have Sitefinity downloads to use support in our forums.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. vikas
    vikas avatar
    3 posts
    Registered:
    10 Jul 2012
    07 Apr 2009
    Link to this post
    Hi IvanN class=RadEWrongWord id=RadESpellError_0>Ivan,

      So there is no waRadFileExploreritelerik size type display in Grid in RadFileExplvikas/goel> telerik control). If any way . please send me your suggestion.Regardsvikas goel
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Apr 2009
    Link to this post
    Hi vikas,

    Here is an example that shows how to work with items in FileExplorer control. It converts files size in KB. Generally the size is in bytes. You can divide the value in KB to 1024 to get the size in bites.

         
            function OnClientFolderLoaded(sender, args) { 
                var radExplorer = $find('<%= radExplorer.ClientID %>'); 
                var getGrid = radExplorer.get_grid(); 
     
                var table = getGrid.get_masterTableView(); 
                var rows = table.get_dataItems(); 
                 
                forvar i = 0 ; i < rows.length ; i++ ) { 
                    var row = rows[i]; 
                    var sizeInBytes = row.get_cell("Size").innerHTML
                    var inegerValue = -1; 
                    try
                        inegerValue = parseInt(sizeInBytes); 
                    } 
                    catch (err) 
                    { 
                        inegerValue = -1;  
                    } 
                    if( inegerValue > 0 ) 
                    { 
                        var textInKB = Math.round(inegerValue/1024); 
                        if( textInKB < 1 ) 
                        { 
                            textInKB = 1; 
                        } 
                        textInKB = textInKB + " KB"
                        row.get_cell("Size").innerHTML = textInKB; 
                    } 
                     
                } 
            } 

    For more information please check client site events for RadGrid control and RadFileExplorer.
    I hope this helps.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered