从电子图书上拷贝的代码却编译通不过——真见鬼!
源代码:
<Html>
<ASP:Table Id="Table1" BorderWidth="1px" GridLines="Both"
Cellspacing="0"
Cellpadding="1"
Runat="Server" />
<Script Language="VB" Runat="Server">
Sub Page_Load(Sender As Object,e As Eventargs)
Dim I, J As Short
For I=0 To 4
Dim Row As New TableRow
For J=0 to 3
Dim Cell As New TableCell
Cell.Text=" Column=" & J
If J=3 Then
Dim btnA As New Button
btnA.Text ="Column=3"
Cell.Controls.Add(btnA)
End If
Row.Cells.Add(Cell)
Next
Table1.Rows.Add(Row)
Next
End Sub
</Script>
</Html>
代码来源:
《ASP.NET 程序设计基础篇》 原 作 者:林煌章
异常详细信息: System.Web.HttpException: 类型“Button”的控件“_ctl0”必须放在具有 runat=server 的窗体标记内。
我怀疑是我的配置版本太新了:版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573