This is a migrated thread and some comments may be shown as answers.

Aborting server side event handler depending on client

2 Answers 60 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 08 Apr 2011, 10:49 AM
Hi,

Any help on this matter would be greatly appreciated, I have been stuck on it for a good while now.

I have a radtoolbar, I have two events handled:

OnClientButtonClicked="RadToolBar_ClientButtonClicked"
OnButtonClick="RadToolBar_ButtonClick" 

Depending on the outcome of the RadToolBar_ClientButtonClicked method (javascript) I would like to/not to handle the OnButtonClick event using the RadToolBar_ButtonClick (c#) - that is, if the client-side method returns false I would like the server-side method to just not execute (I don't even want an alternative method to run, just want it to do nothing).

I have tried the following..

OnClientButtonClicked="return RadToolBar_ClientButtonClicked()"
and
OnClientButtonClicked="return RadToolBar_ClientButtonClicked();"

...but on doing this the page simply does not load (remains blank white).

Thanks a LOT!!!

Dan

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 08 Apr 2011, 11:39 AM
Hello Daniel,


You could attach OnClientButtonClicking event to RadToolBar, and use the args.set_canel(true) method to cancel the event.
OnClientButtonClicking



Thanks,
Princy.
0
Daniel
Top achievements
Rank 1
answered on 08 Apr 2011, 11:44 AM
EDITED: F*cking brilliant Princy!! Been at that for hours now mate, appreciate it!!
Tags
ToolBar
Asked by
Daniel
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Daniel
Top achievements
Rank 1
Share this question
or