The html element calls the server method, and the html element calls
Background: asp.net layer-3 Server Control for Secondary Development
During Development today, we found that many things in this system are encapsulated and a problem is also found.
How to Use the Dopostback method?
I found that some html elements do not bind interaction methods to them, nor are they server controls.
You click to interact with data.
I have studied it carefully and decided to share it with you.
First, add a server control.
Binding Methods to server controls
As shown in figure
Then I added an html element to bind dopostback to it in js.
Then, as shown in this html element, You can execute the method used by the first Server Control.
View the page source. This is automatically generated on the page discovery page.
Combined with dopostback Parameters
Aaa is actually eventTarget "" and eventArgument.
The return false is used to prevent the page from being executed.
Because after the form1 form is submit, this is only the first sentence in the method of bbb_onclick ().
_ DoPostBack ('aaa', ''); if your bbb method is followed by a later method, the page can continue to be executed.
Therefore, when using this method, it is best to add this return false. After all, this method is the best method for human writing.
Another method is to simulate server clicks
It can be implemented like this