c# - To avoid re-run the code, click on Refresh page -
i have listview control in aspx page , control inside listview control:
<asp:linkbutton id="addtocart" runat="server" commandargument='<%# eval("productid") %>' oncommand="addtocart_click">add cart</asp:linkbutton>
and use code master page:
<%@ page enableviewstate="true" viewstatemode="disabled" ...
also, listview viewstatemode enabled. , code:
protected void addtocart_click(object sender, commandeventargs e) { //insert product cart table }
first, i'll click on addtocart , code executed. (this ok) but, code re-runs (insert product cart table) when click on refresh page!!
you can redirect page addtocart_click callback.
response.redirect("pageurl.aspx");
you refer pattern: http://en.wikipedia.org/wiki/post/redirect/get
Comments
Post a Comment