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

Adding a GridClientSelectColumn to FileExplorer

1 Answer 49 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
kencox
Top achievements
Rank 1
kencox asked on 29 Jul 2012, 06:48 PM
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?

Ken

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;
RadFileExplorer1.Grid.Columns.AddAt(0,GridClientSelectColumn1);

1 Answer, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 01 Aug 2012, 03:34 PM
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
    }
</script>

I hope this helps.

Regards,
Dobromir
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.
Tags
FileExplorer
Asked by
kencox
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Share this question
or