View Full Version : [CLOSED] Button: Direct event executes although click listener returns false value (Razor)

Apr 09, 2012, 2:00 PM
Hi, on window form i have one button, Listener and DirectEvent on it. When user click on button I return false value from ButtonPrijava_Click(). In clasic aspx synthax when Listener click handler returns false direct event does not execute. Here in razor syntax when handler return false value direct event still execute. How to fix this?

Here is code:

... ...
.Buttons(item =>
item.Add(Html.X().Button().ID("ButtonPrijava").Text("Prijavi me").Icon(Icon.Accept)
.Listeners(listeners => { listeners.Click.Handler = "ButtonPrijava_Click();"; })
.DirectEvents(directEvents => { directEvents.Click.Url = "/Account/LogInUser"; }));

function ButtonPrijava_Click() {

return false;

Apr 09, 2012, 2:07 PM

You have to use 'return' in Handler

listeners.Click.Handler = "return ButtonPrijava_Click();"

or use Fn

listeners.Click.Fn = "ButtonPrijava_Click"

Apr 09, 2012, 2:13 PM
Thanks, it is my omission.