0
votes

I know many posts discussed about it. but I still can't find any solution works.

my ASPX CODE

<asp:Button ID="Booking1Btn" runat="server" CssClass="col-8 SureButton" Text ="NEXT" OnClientClick="javascript: return calcRoute()" OnClick="Booking1Btn_Click" />

if calcRoute() all route return false. the calcRoute() working fine, but onClick not fire. if calcRoute() return true, OnClick fire. but calcRoute() not working.

I have try OnClientClick="if (!calcRoute()) { return false; }" and OnClientClick="calcRoute(); return false; ". but all same, after onClientClick, onClick not fire.

why this rule not working,

calcRoute return true, onClick fired, 
calcRoute return false, onClick not fired. 
2

2 Answers

0
votes

Try this code. It might possible that OnClientClick you have to mention onclick function and initialise return value.

<asp:Button ID="Booking1Btn" runat="server" CssClass="col-8 SureButton" Text ="NEXT" OnClientClick="javascript: calcRoute(); return false" OnClick="Booking1Btn_Click" />

function calcRoute(){
return true;
}
0
votes

Try this.

<asp:Button ID="Booking1Btn" runat="server" CssClass="col-8 SureButton" Text ="NEXT" OnClientClick="return calcRoute()" OnClick="Booking1Btn_Click" />