How to remove the problem summary from the refresh page

Source: Internet
Author: User

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.

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.