Hi, ive added a custom button to my FileExplorer toolbar and want to make it a ExplorerMode switcher using Ajax refreshing. Im unable to make it work correctly but i think im very close. When I click the button, the ExplorerMode property changes (when looking in
Can someone let me know what im doing wrong. It can become a nice feature to share to other members if this can work.
TIA
RadAjaxManager1_AjaxRequest
) but nothing happens visually. Here's the code:<
telerik:RadFileExplorer
runat
=
"server"
ID
=
"RadFileExplorer1"
Skin
=
"WebBlue"
Width
=
"99.7%"
Height
=
"250px"
AllowPaging
=
"true"
PageSize
=
"50"
ExplorerMode
=
"Default"
CssClass
=
"rfeLargeThumbnails"
EnableFilterTextBox
=
"true"
EnableFilteringOnEnterPressed
=
"false"
FilterTextBoxLabel
=
"Filter By"
meta:resourcekey
=
"labFilterBy"
DisplayUpFolderItem
=
"false"
OnClientFileOpen
=
"OnClientFileOpen"
OnClientLoad
=
"attachHandlers"
>
<
Configuration
EnableAsyncUpload
=
"true"
MaxUploadFileSize
=
"10485760"
/>
</
telerik:RadFileExplorer
>
function
toolbarClicked(toolbar, args) {
var
buttonValue = args.get_item().get_value();
if
(buttonValue ==
"ViewMode"
) {
var
ajaxManager = $find(
"<%= RadAjaxManager1.ClientID %>"
);
ajaxManager.ajaxRequest(
"RadFileExplorer1_ViewMode"
);
}
}
function
attachHandlers(explorer, args) {
var
toolbar = explorer.get_toolbar();
toolbar.add_buttonClicked(toolbarClicked);
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RadToolBarButton customButton =
new
RadToolBarButton(
"ViewMode"
);
customButton.CssClass =
"custom_button"
;
customButton.Value =
"ViewMode"
;
customButton.Text =
"View Mode"
;
RadFileExplorer1.ToolBar.Items.Add(customButton);
}
}
protected
void
RadAjaxManager1_AjaxRequest(
object
sender, AjaxRequestEventArgs e)
{
if
(e.Argument ==
"RadFileExplorer1_ViewMode"
)
{
if
(RadFileExplorer1.ExplorerMode == Telerik.Web.UI.FileExplorer.FileExplorerMode.Default)
{
RadFileExplorer1.ExplorerMode = Telerik.Web.UI.FileExplorer.FileExplorerMode.Thumbnails;
}
else
{
RadFileExplorer1.ExplorerMode = Telerik.Web.UI.FileExplorer.FileExplorerMode.Default;
}
}
}
Can someone let me know what im doing wrong. It can become a nice feature to share to other members if this can work.
TIA