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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -