Don't go for a server side for only redirecting you can take one achor tag also
<div align="right" style="padding-top: 10px;"> <a id="lnkcheckout" href="checkout1">Checkout</a> </div>
And it will work :) I hope this will help you
Question
I am working on a project in which I am binding Cart:
As shown in image I am populating my cart. Using User Control. And in User control I have populated that using One simple aspx form that is minicart. So now as you can see there is one button Checkout
in That page. Which is populated through User Control but actaully its inside my minicart form. So now if I am trying to redirect using that Checkout
link button. But that is not calling my click event rather its just postback the page.
Basically I want to call aspx page's click event through user control in my another aspx page.
I have tried to call that click event through many ways. But still page is only doing postback
. I just want respose.redirect
to my checkout page.
Even I have tried by using <a>
also:
<a id="lnkcheckout" runat="server" href="javascript:return false;"
onclick="checkout_onclick">Checkout</a>
But not succeed..
Solution
Don't go for a server side for only redirecting you can take one achor tag also
<div align="right" style="padding-top: 10px;"> <a id="lnkcheckout" href="checkout1">Checkout</a> </div>
And it will work :) I hope this will help you
OTHER TIPS
Try to use event.preventDefault() or use return false
like ,
jQuery(function(){
jQuery(document).on('click','.morebutton', function(e){
e.preventDefault();
alert('ok');// you code in place of alert;
});
});