aspnet-mvc-ej1-demos/Views/FileExplorer/Methods.cshtml

164 строки
6.4 KiB
Plaintext

@section MetaTags{
<meta name="description" content="This example demonstrates the various methods like enable and disable in a ASP.NET MVC File Explorer." >
}
@section SampleHeading{ <span class="sampleName">FileExplorer-Methods-ASP.NET MVC-SYNCFUSION</span>}
@section ControlsSection{
@(Html.EJ().FileExplorer("fileExplorer").Path("~/FileExplorerContent/").AjaxAction(@Url.Content("FileActionMethods"))
.Width("100%").IsResponsive(true).MinWidth("150px"))
}
@section PropertiesSection{
<div class="row">
<div class="col-md-3">
Toolbar
</div>
<div class="col-md-3">
@(Html.EJ().ToggleButton("check1").Width("105px").Size(ButtonSize.Normal).ContentType(ContentType.TextOnly).DefaultText("Hide")
.ActiveText("Show").ClientSideEvents(evt => evt.Click("Toolbar")))
</div>
</div>
<div class="row">
<div class="col-md-3">
Status Bar
</div>
<div class="col-md-3">
@(Html.EJ().ToggleButton("check2").Width("105px").Size(ButtonSize.Normal).ContentType(ContentType.TextOnly).DefaultText("Hide")
.ActiveText("Show").ClientSideEvents(evt => evt.Click("Statusbar")))
</div>
</div>
<div class="row">
<div class="col-md-3">
Treeview
</div>
<div class="col-md-3">
@(Html.EJ().ToggleButton("check3").Width("105px").Size(ButtonSize.Normal).ContentType(ContentType.TextOnly).DefaultText("Hide")
.ActiveText("Show").ClientSideEvents(evt => evt.Click("Treeview")))
</div>
</div>
<div class="row">
<div class="col-md-3">
ContextMenu
</div>
<div class="col-md-3">
@(Html.EJ().ToggleButton("check5").Width("105px").Size(ButtonSize.Normal).ContentType(ContentType.TextOnly).DefaultText("Disable")
.ActiveText("Enable").ClientSideEvents(evt => evt.Click("ContextMenu")))
</div>
</div>
<div class="row">
<div class="col-md-3">
Destroy/Restore
</div>
<div class="col-md-3">
@(Html.EJ().ToggleButton("check6").Width("105px").Size(ButtonSize.Normal).ContentType(ContentType.TextOnly).DefaultText("Destroy")
.ActiveText("Restore").ClientSideEvents(evt => evt.Click("onDestoryRestore")))
</div>
</div>
<div class="row">
<div class="col-md-3">
Diable/Enable AddFolder
</div>
<div class="col-md-3">
@(Html.EJ().ToggleButton("check7").Width("105px").Size(ButtonSize.Normal).ContentType(ContentType.TextOnly).DefaultText("Disable")
.ActiveText("Enable").ClientSideEvents(evt => evt.Click("onDisableEnable")))
</div>
</div>
<div class="row">
<div class="col-md-3">
Get Current Path
</div>
<div class="col-md-3">
@(Html.EJ().Button("getPath").Width("105px").Text("Get Path").ClientSideEvents(evt => evt.Click("getCurrentPath")))
</div>
</div>
<div class="row">
<div class="col-md-3">
Show/Hide Checkbox
</div>
<div class="col-md-3">
@(Html.EJ().ToggleButton("check8").Width("105px").Size(ButtonSize.Normal).ContentType(ContentType.TextOnly).DefaultText("Hide")
.ActiveText("Show").ClientSideEvents(evt => evt.Click("onShowHide")))
</div>
</div>
}
@section ScriptSection{
<script>
var fileExplorerObj;
$(function () {
fileExplorerObj = $("#fileExplorer").data("ejFileExplorer");
});
function Toolbar(args) {
if (fileExplorerObj)
fileExplorerObj.option("showToolbar", !args.isChecked);
}
function Statusbar(args) {
if (fileExplorerObj)
fileExplorerObj.option("showFooter", !args.isChecked);
}
function Treeview(args) {
if (fileExplorerObj)
fileExplorerObj.option("showNavigationPane", !args.isChecked);
}
function ContextMenu(args) {
if (fileExplorerObj)
fileExplorerObj.option("showContextMenu", !args.isChecked);
}
function RTLSupport(args) {
if (fileExplorerObj)
fileExplorerObj.option("enableRTL", args.isChecked);
}
function onDestoryRestore(args) {
if (args.isChecked) {
fileExplorerObj.destroy();
fileExplorerObj = null;
if (!$("#check6").hasClass("not-disable"))
$("#check6").addClass("not-disable");
var desobj = $("#sampleProperties .e-togglebutton.e-js").not(".not-disable");
desobj.ejToggleButton("disable");
desobj.ejToggleButton({ "toggleState": false });
$("#getPath").ejButton("disable");
}
else {
$("#fileExplorer").ejFileExplorer({
isResponsive: true,
width: "100%",
minWidth: "150px",
path: "@Url.Content("~/FileExplorerContent/")",
ajaxAction: "@Url.Content("FileActionMethods")"
});
fileExplorerObj = $("#fileExplorer").data("ejFileExplorer");
$("#sampleProperties .e-togglebutton.e-js").not(".not-disable").ejToggleButton("enable");
$("#getPath").ejButton("enable");
}
}
function getCurrentPath() {
if (fileExplorerObj)
alert(fileExplorerObj.option("selectedFolder"));
}
function onDisableEnable(args) {
if (args.isChecked) {
if (fileExplorerObj) {
fileExplorerObj.disableToolbarItem("NewFolder");
fileExplorerObj.disableMenuItem("New folder");
}
}
else {
if (fileExplorerObj) {
fileExplorerObj.enableToolbarItem("NewFolder");
fileExplorerObj.enableMenuItem("New folder");
}
}
}
function onShowHide(args) {
if (fileExplorerObj)
fileExplorerObj.option("showCheckbox", !args.isChecked);
}
$(document).ready(function () { $("#sampleProperties").ejPropertiesPanel(); });
</script>
}