Reputation: 437
I'm trying to find a way to set the click event for the kendo button. The default action is to refresh page which I want to get rid of.
I want to close the current window when the button is pressed. I'm working on ASP.NET MVC and using html helper to add the button.
@(Html.Kendo().Button()
.Name("closeFormBtn")
.Content("Close")
.Events(events => events
.Click("closeForm"))
)
Unfortunately the above click event doesn't work and the default refresh action is applied every time a button is pressed. The closeForm script works ok as it has already been tested. I'm also trying to find a way of not using script at all, just to insert code inside the Click(" ") event.
Upvotes: 1
Views: 6616
Reputation: 139
This should work.
function closeForm(e) {
e.preventDefault();
//if that doesn't work, try adding:
e.stopPropogation();
//your code
}
Upvotes: 1
Reputation: 140
In the closeForm Method. Return false in the end of the function.
function closeForm(){
//Your Code
return false;
}
Upvotes: 1