Basically, I have a bulleted list inside the listview, and when a user selects and item, I want it to automatically fire the create action method. And when the user deselects I want it to fire the Destroy action method
1 Answer, 1 is accepted
0
Vladimir Iliev
Telerik team
answered on 04 Oct 2012, 08:52 AM
Hi Benjamin,
Basically you should use the change event of the ListView to perform actions with the last and currently selected items when the event is fired.
e.g.:
var lastSelectedItem;
function onChange(arg) {
var currentSelectedItem;
currentSelectedItem = this;
if (!lastSelectedItem) {
//First item selected
lastSelectedItem = currentSelectedItem;
}
else {
//lastItemSelected is unselected now
//Make ajax call to the Destroy action
//$.ajax({
// url: 'ajax/Destroy',
// success: function (data) {
// alert('Load was performed.');
// }
//});
}
//Make ajax call to the Create action
//$.ajax({
// url: 'ajax/Create',
// success: function (data) {
// alert('Load was performed.');
// }
//});
//save the currently selected item
lastSelectedItem = currentSelectedItem;
}
Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!