or
@(Html.Kendo().DatePickerFor(m => Model.SearchInfo.StartDate).Name("start-date")
columns.Bound(c => c.Id).Title("")
.ClientTemplate(@Html.ActionLink("Download", "DownloadReport?Id=#=Id#")
.ToHtmlString());
Hi Team,
I am using ImageBrowser as a part of editor widget in my screen . I need to delete an image only if it is not used by other resources. I wired the destroy to an action that checks whether its in use or not. If its in use I would return a message saying it could not be deleted .I got stuck on how to return this message to destroy and stop it from deleting the image from the library.
As the documentation says the configuration values will be sent to jquery.Ajax() function I tried using the success and error functions in the destroy configuration but could not handle the request. It always shows up as undefined.This is how I configured my imagebrowser.
01.
imageBrowser: {
02.
path:
"/BroadcastType/"
,
03.
transport: {
04.
read: {
05.
url:
function
() { $(
".k-breadcrumbs.k-textbox"
).css(
'display'
,
'none'
);
return
"../ImageBrowser/Read"
},
06.
type:
"POST"
07.
},
08.
destroy: {
09.
url:
"../ImageBrowser/Destroy"
,
10.
type:
"POST"
,
11.
success:
function
(){},
12.
error:
function
(){}
13.
},
14.
thumbnailUrl:
"../ImageBrowser/Thumbnail"
,
15.
uploadUrl:
"../ImageBrowser/Upload"
,
16.
imageUrl:
"../ImageBrowser/Image?name={0}"
17.
}
18.
}
01.
[HttpPost]
02.
public
ActionResult ReadEmployee([DataSourceRequest] DataSourceRequest command,
string
searchName){
03.
var empList = GetEmployeeListByFirstAndLastName(searchName)
04.
var result =
new
DataSourceResult
05.
{
06.
Data = empList .FirstName,
07.
Total = empList .LastName
08.
};
09.
return
Json(result,JsonRequestBehavior.AllowGet);
@(Html.Kendo().Grid<
EmployeeModel
>()
.Name("Grid")
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("ReadEmployee", "Home", "#"))
)
.Columns(columns =>
{
columns.FirstName
})
.Sortable()
.Scrollable(scrollable => scrollable.Height("auto"))
.Resizable(resizing => resizing.Columns(true))
.Pageable(pager =>
{
pager.Refresh(true);
pager.Numeric(true);
}))
<
div
class
=
"editor-field edit-project"
>
(Html.Kendo().ComboBox()
.Name("PersonId")
.HtmlAttributes(new { @class = "input-project" })
.DataTextField("Fullname").DataValueField("Id")
.DataSource(source => { source.Read(read => { read.Action("GetPeople", "Project"); }); })
.MinLength(3)
.Filter("contains")
.Events(ev => ev.Change("checkcombobox")))
</
div
>
function checkcombobox(e)
{
if (this.value() && this.selectedIndex == -1) {
alert('Gelieve een geldige persoon te selecteren');
var cbx = $("#PersonId").data("kendoComboBox").Selected(0);
}
}