I am working on an asp.net web forms project. I have an asp.net button which has both OnClientClick and onClick events. The OnClientClick event executes the javascript function processHolidayDates() which in turn shows a Telerik's Ok/Cancel message box. When the Ok button is clicked it will return true and if the Cancel button is clicked it will return false. So, when false is returned, I don't want the button click event to execute the server side code. However, the moment the message box is displayed already the code behind under the btnCreate_Click is executed. When I add "return false;" at the OnClientClick as in "OnClientClick="javascript:processHolidayDates(); return false " , the code behind is never executed even if I chose Ok in the message box. The following is my code on the aspx page
<asp:button id="btnCreate" runat="server" Text="Create" OnClientClick="javascript:processHolidayDates(); " onclick="btnCreate_Click"></asp:button>
function processStartAndEndDates() {
var oConfirm = radconfirm('Hello', callBackFn, 400, 300, null, 'Test');
return oConfirm ;
}
javascript:
within an event handler. Not an answer, just to save you some typing. – Heretic Monkey