Customize the value shown in the Size column

Thread is closed for posting
3 posts, 0 answers
  1. 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD
    63F75A2C-1F16-4AED-AFE8-B1BBD57646AD avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 15 Dec 2009 Link to this post

    Requirements

    RadControls version

    RadFileExplorer for ASP.NET AJAX
    .NET version

    2.0 / 3.5
    Visual Studio version

    2005 / 2008 /
    programming language JavaScript
    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    Customize the value shown in the Size column

    THE IMPLEMENTATION
    • Attach a handler to the OnRowDataBound event of the RadGrid (embedded in RadFileExplorer) :
      protected void Page_Load(object sender, EventArgs e)
      {
          RadFileExplorer1.Grid.ClientSettings.ClientEvents.OnRowDataBound = "OnGridRowDataBound";
      }
    • Then implement the handler as follows:
      function OnGridRowDataBound(oGrid, args)
      {
          var dataItem = args.get_dataItem();
          if (dataItem.Length != null)
          {
              dataItem.Length = formatSizeValue(dataItem.Length);
          }
      }

    The full implementation of the described solution (including formatSizeValue method) can be found attached to the thread.

    THE RESULT

  2. 26F4A7E2-FB2C-48C4-A22B-A593F5F23A24
    26F4A7E2-FB2C-48C4-A22B-A593F5F23A24 avatar
    3 posts
    Member since:
    Jan 2010

    Posted 26 Jan 2010 Link to this post

    For those that need a little more in the formatSizeValue method, I adapted this from my C# tool kit.  It's a bit of an over kill but you can edit it as needed.  Just replace the one in the example code.

    Hope you find it useful.
  3. 93662917-1E03-49EC-9286-033C9D1BF79E
    93662917-1E03-49EC-9286-033C9D1BF79E avatar
    1406 posts
    Member since:
    May 2014

    Posted 29 Jan 2010 Link to this post

    Hello WS,

    Thank you for the provided code. I believe that the provided JavaScript function will be of help for our  community.

    Best wishes,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.