Adding a GridClientSelectColumn to FileExplorer

2 posts, 0 answers
  1. kencox
    kencox avatar
    106 posts
    Member since:
    Oct 2002

    Posted 29 Jul 2012 Link to this post

    I'm trying to add a GridClientSelectColumn with checkboxes to the FileExplorer to make it easier to select (check) files to be processed.

    For some reason, the row appears selected but the checkbox doesn't show.

    I've inserted the code I have so far below.

    Any ideas?


    GridClientSelectColumn GridClientSelectColumn1 = new GridClientSelectColumn();
    GridClientSelectColumn1.UniqueName = "Select";
    GridClientSelectColumn1.ItemStyle.VerticalAlign = System.Web.UI.WebControls.VerticalAlign.Top;
    GridClientSelectColumn1.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(35);
    GridClientSelectColumn1.HeaderStyle.VerticalAlign = System.Web.UI.WebControls.VerticalAlign.Top;
    GridClientSelectColumn1.HeaderStyle.Width = System.Web.UI.WebControls.Unit.Pixel(35);
    GridClientSelectColumn1.HeaderText = "";
    GridClientSelectColumn1.Visible = true;
  2. Dobromir
    Dobromir avatar
    1633 posts

    Posted 01 Aug 2012 Link to this post

    Hi Ken,

    You need to use the approach shown in this article and add an <input type="checkbox" instead of an img. You can directly attach a JavaScript handler to the checkboxes by using this approach:

    in the content provider:
    public override DirectoryItem ResolveDirectory(string path)
        DirectoryItem oldItem = base.ResolveDirectory(path);
        foreach (FileItem fileItem in oldItem.Files)
            string[] imageExtensios = new string[] { ".jpg", ".gif", ".png" };// Images extensios
            if (imageExtensios.Contains(fileItem.Extension))
            {//Show thumbnails for images only
                string pathToFile = fileItem.Location;
                string htmlText = string.Format("<input type='checkbox' checked='{0}' onclick='onClickHandler(this);' />", "checked");
                fileItem.Attributes.Add("Thumb", htmlText);
        return oldItem;

    The implementation of the  onClickHandler:
    <script type="text/javascript">
        function onClickHandler(checkBox)
            var currentState = checkBox.checked;
            // your logic

    I hope this helps.

    the Telerik team
    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 their blog feed now.
Back to Top