Add JavaScript client events for server controls

zhaozj2021-02-16  43

I remember to use JavaScript when using ASP. For example, verify the form, delete confirmation, etc. ASP.NET is server-side, our JavaScript lost space for the application. However, after some exploration, ASP.NET is very simple to use JavaScript.

Let's introduce WebControl's Attributes properties. (HTMLControl is similar, no longer repetition), Attributes is a collection of any feature that is not corresponding to the property (only for rendering). For example, an ordinary form control This is the attribute of the button, the onclick button list After the event. These can be set through the Attributes property collection in ASP.NET.

The following is an example of login table verification. <% @ Page language = "c #"%>