How to remove <asp: button> </ASP: button> back-to-back refresh the problem summary on the entire page
Http://topic.csdn.net/u/20080928/01/9f2faddd-0b17-47c6-8699-da03f623c7e6.html
The system is ASP. net2.0. Use vs2005. Ajax is used.
<Asp: button id = "btnsearch" onclientclick = "reqshopproductsales ()" runat = "server" text = '<% $ resources: resource, shop_serach %>'/>
Such a server control. Reqshopproductsales () is a JavaScript method. When the client clicks the button, the reqshopproductsales () operation is successful, and the data is displayed successfully. (The alert test confirms that JavaScript is correct ). But it was immediately refreshed by ASP: the feature of the button itself, and the whole page was refreshed by the return, so that no data was found on the page. So, is there any way or how to set it to prevent ASP: button refreshing and keep Ajax refreshing ??
You have tried several methods but have not succeeded.
For example, remove onclientclick = "reqshopproductsales ()" In! Btnsearch. Attributes. Add ("onclick", "Return reqshopproductsales ();") is added to ispostback. If no result is returned, the button is refreshed.
I was originally input. Because of the text = '<% $ resources: resource, shop_serach %>' sentence, I had to change it to <asp: button/>.
Solution:
HTML code
<Asp: button id = "btnsearch" onclientclick = "Return reqshopproductsales ()" runat = "server" text = '<% $ resources: resource, shop_serach %> '/> <SCRIPT> function reqshopproductsales (){/*..... your code, */return false; // =================== do not submit a form, note that the above Code should not have a return statement. If return false is required, do not return true;} </SCRIPT>
Summary:
The key is onclientclick = "Return reqshopproductsales ()" And return false ;.
Onclientclick = "Return reqshopproductsales ()" is missing a return.
In general, this is a question about JavaScript usage skills, and whether javascript can be understood in depth or not.