Recently, I was doing a web back-end statistical system. I originally realized it all with ASP.NET (code binding), but I found that some functions are easier to use JavaScript. Many places involve interactions between C and S and database operations, JavaScript is stronger in the client control interface, but operating the database on the server or ASP.NET is better.
The JS function is binding to the ASP.NET control: Use the control .attributes.add (event, function), you can always report an error when you add oncheckedchanged events to checkbox.
Access HTML controls in ASP.NET: Under the ASP, all controls are replaced with HTML, and then add Runat = Server on the control, it can be referenced in ASP.NET. Use (FindControl (Control ID) AS HTML control type). Properties, such as (this.FindControl ("DDLMONTH") AS HTMLSELECT) .SelectedIndex ...
Reading the ASP.NET in the HTML web page, in order to be able to read data in the ASP.NET in JS, to ensure that the type JS of the variable in the ASP.NET can distinguish, it is really thinking that it will become a string! Second, to declare the variable as public. Use variables in JS = "" # asp.net variable name%> ";, the value of the variable can be obtained, such as VAR ID =" <% # userid%> "; (public string userid = in ASP.NET = "zhangsan";
Can use JS and ASP.NET good combination to play their strengths, the use of taro in the development process, it is really possible to do it!