在文件a.aspx中定义了:
<asp:Panel ID="pl1" Runat="server">
<form runat="server">
product<asp:TextBox ID="TextBox1" Runat=server /><br>
price<asp:TextBox ID="TextBox2" Runat=server />
<input type=submit name="submit" value="submit">
</form>
</asp:Panel>
在文件a.aspx.vb中引用pl1.visible,为什么说我pl1没有定义?应该怎么解决?

解决方案 »

  1.   

    大哥,所以的web控件都必须放在runat属性是server的form之内的
    你这样就算不提示你找不到pll,执行的时候也会提示pll必须放在form之内的。
    晕死了.........无语..................
      

  2.   

    在aspx里好象只能有一个FORM,所有服务端控件都要放在 有runat="server“标识的form里
      

  3.   

    放进去了啊,可还是提示找不到啊
    以下是全部代码:
    a.aspx:
    <form runat="server">
    <asp:Panel ID="pl1" Runat="server">
    product<asp:TextBox ID="TextBox1" Runat=server /></FONT><br>
    price<asp:TextBox ID="TextBox2" Runat=server />
    <input type=submit name="submit" value="submit">
    </asp:Panel>
    </form>
    a.aspx.vb:
        Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            '在此处放置初始化页的用户代码
            If IsPostBack Then
                Dim objCookie1 As System.Web.HttpCookie
                Dim objCookie2 As System.Web.HttpCookie
                objCookie1 = New System.Web.HttpCookie("ProductName", Request.Params("TextBox1"))
                Response.Cookies.Add(objCookie1)
                objCookie2 = New System.Web.HttpCookie("UnitPrice", Request.Params("TextBox2"))
                Response.Cookies.Add(objCookie2)
                Label1.Text = Request.Cookies("ProductName").Value
                TextBox1.Visible = False
                TextBox2.Visible = False
                pl1.Visible = False
            End If
        End Sub