js函数绑定到asp.net的控件上: 用 控件.Attributes.Add(事件,函数) 。 在 asp.net 中访问 html 控件: 一气之下,把所有控件都换成了 html 的,然后在控件上加上 runat=server 这样在 asp.net 中就可以引用了。用 (FindControl(控件id) as html控件类型).属性,如 (this.FindControl("ddlMonth") as HtmlSelect).SelectedIndex ...... 在html网页中读取asp.net的变量: 为了能够在js中读取asp.net中的数据,要保证asp.net中变量的类型js能够分辨,其实想办法变成string的就得了呗! 其次,要把变量声明为 Public 的。 在js中使用 变量="<%= asp.net变量名 %>"; 的形式即可得到变量的值,如 var id = "<%= userid %>"; (asp.net中Public string userid = "zhangsan";)
REF:
http://encosia.com/2007/08/08/robust-aspnet-control-referencing-in-javascript/
http://www.codeguru.com/Csharp/.NET/net_asp/scripting/article.php/c5337/
http://www.newasp.net/tech/net/10571.html
http://msdn.microsoft.com/en-us/library/aa479011.aspx
http://dotnetslackers.com/articles/aspnet/JavaScript_with_ASP_NET_2_0_Pages_Part1.aspx
http://dotnetslackers.com/articles/aspnet/JavaScript_with_ASP_NET_2_0_Pages_Part2.aspx
http://www.builderau.com.au/program/dotnet/soa/Combining-JavaScript-with-ASP-NET-Web-forms/0,339028399,339130406,00.htm
http://www.ondotnet.com/pub/a/dotnet/2003/09/15/aspnet.html
http://www.developer.com/net/asp/article.php/2237431
http://www.codeproject.com/KB/custom-controls/scriptgen.aspx
http://www.ben-rush.net/blog/PermaLink.aspx?guid=70870288-191a-4dd0-a1a0-61365a26dea1&dotnet=consultant
http://www.aspcode.net/ASPNET-Server-control-with-JavaScript.aspx
http://www.dotnetjunkies.ddj.com/Tutorial/FF0DFDB6-FF73-4DC5-859C-F6C2CB8A36E0.dcik
|
请发表评论