在 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";