This article goes on to say a common sense question.
As we all know, ASP. NET page has a Page_Load event. This event is executed when the page loads for the first time. The careful children's shoes must also find that when the event is registered to the control on the page, the Page_Load is executed when the event is executed. This means that each click will refresh the page, causing the page to blink. This effect is not good.
So how to avoid this problem, of course, is by JavaScript, as well as the high-level jquery and so on.
The General ASP. NET page must be implemented with JavaScript. The events of the page control are best implemented in JavaScript, and then the data is passed through JavaScript, as well as on how to pass in Jquery.js and Ajax. Also mentioned in the previous two methods $.ajax and $.post two methods to achieve the front and back table interaction.
Another small detail is the use of the return keyword in the event of a control. as follows, a button's Click event can be defined like this.
<asp:button id= "button1" runat= "Server" text= "page click" onclientclick= "return Buttonclientclick ();"/>
The corresponding JS function:
function Buttonclientclick () { //Business //Is $.ajax or $.post, and other methods and background interaction return false; }
The point is to add return when calling the function, and then remember to return to false in the function;
In this way, even through the JS method of interactive data, into the Page_Load method. The page will not blink.