PDA

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



boris
Apr 09, 2012, 3: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:


@(Html.X().Window().ID("WindowLogIn")
... ...
.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;
}

Vladimir
Apr 09, 2012, 3:07 PM
Hi,

You have to use 'return' in Handler


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


or use Fn


listeners.Click.Fn = "ButtonPrijava_Click"

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