Inherits="sbgl.WebForm1"这是你的html页面第一句的部分语句,我想询问的是你的sbg1是不是名称空间的名称,如果是,那么在代码没有这个名称的限定啊!!
加上或者删除这个名称空间试一试!!

解决方案 »

  1.   

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            '在此处放置初始化页的用户代码
            Label1.Text = "page load here"
        End Sub
    不好意思不知道是vb
    在Page_Load事件必须加上
    if (!Page.IsPostBack)
    {
    Label1.Text = "page load here";
    }(c#),
    这样就不会在事件执行时再进行一遍赋值了,你自己改成vb把,其他不用改
      

  2.   

    谢谢两位的帮助,我将程序又修改了
    <%@ Page Language="vb" Codebehind="WebForm1.aspx.vb" AutoEventWireup="false" Inherits="sbgl.WebForm1" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>WebForm1</title>
    <meta content="Microsoft Visual Studio .NET 7.0" name="GENERATOR">
    <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" runat="server">
    <FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体">
    </FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT>
    <br>
    <asp:button id="ValidateBtn" style="Z-INDEX: 102; LEFT: 166px; POSITION: absolute; TOP: 168px" runat="server" Text="valid"></asp:button>
    <asp:label id="lblOutput" style="Z-INDEX: 103; LEFT: 106px; POSITION: absolute; TOP: 56px" runat="server" Text="Fill in the required fields below" Width="237px" Font-Size="10" Font-Name="Verdana" ForeColor="red"></asp:label>
    <asp:textbox id="TextBox1" style="Z-INDEX: 104; LEFT: 107px; POSITION: absolute; TOP: 90px" runat="server" Width="162px" Height="34px"></asp:textbox>
    </form>
    </body>
    </HTML>Imports System
    Imports System.ComponentModel.Design
    Imports System.Data
    Imports System.Drawing
    Imports System.Web
    Imports System.Web.SessionState
    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    Imports System.Web.UI.HtmlControls
    Imports Microsoft.VisualBasic
    Imports System.Reflection
    Public Class WebForm1
        Inherits System.Web.UI.Page
        Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
        Protected WithEvents Form3 As System.Web.UI.HtmlControls.HtmlForm
        Protected WithEvents ValidateBtn As System.Web.UI.WebControls.Button
        Protected WithEvents lblOutput As System.Web.UI.WebControls.Label
        Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
        Protected WithEvents Form5 As System.Web.UI.HtmlControls.HtmlForm#Region " Web 窗体设计器生成的代码 "    '该调用是 Web 窗体设计器所必需的。
        <System.Diagnostics.DebuggerStepThrough()> 
        Private Sub InitializeComponent()    End Sub    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
            '不要使用代码编辑器修改它。
            InitializeComponent()
        End Sub#End Region
        Private Sub ValidateBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ValidateBtn.Click
            If Not IsPostBack Then
                'If (Page.IsValid) Then
                lblOutput.Text = "Page is Valid!"
                TextBox1.Text = "valid"
            Else
                lblOutput.Text = "Some of the required fields are empty"
            End If    End Sub
    End Class可是依然不能得到我想要的结果,我想要这样的结果,但是这是我手工写的。
    <%@ Page Language="VB" %>
    <script runat="server">    ' Insert page code here
        '    Sub Button1_Click(sender As Object, e As EventArgs)
            message.text = "ok login"
        End Sub    Sub Page_Load(sender As Object, e As EventArgs)
            message.text = "请您登录"
        End Sub</script>
    <html>
    <head>
        <meta http-equiv="content-type" content="text/html;charset=gb2312" />
    </head>
    <body>
        <form runat="server">
            <p>
                <asp:Label id="Label1" runat="server" font-size="Large" borderstyle="Dotted">设备管理信息系统</asp:Label>
            </p>
            <p>
                <asp:Label id="Label2" runat="server">用户名:</asp:Label>
                <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="用户名必须输入" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
            </p>
            <p>
                <asp:Label id="Label3" runat="server">口令:</asp:Label>
                <asp:TextBox id="TextBox2" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" ErrorMessage="口令必须输入" ControlToValidate="TextBox2"></asp:RequiredFieldValidator>
            </p>
            <p>
                <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="登录"></asp:Button>
            </p>
            <p>
                <asp:Label id="message" runat="server"></asp:Label>
            </p>
            <!-- Insert content here -->
        </form>
    </body>
    </html>
      

  3.   

    some of the effects you are talking about are provided by the client side javascrript, if you want to do server side validation yourself, you should do something like    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
           if Not IsPostBack then
            lblOutput.Text = "请您登录"
    end if
        End Sub    Private Sub ValidateBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ValidateBtn.Click
            If TextBox1.Text.Trim() <> String.Empty Then
                lblOutput.Text = "Page is Valid!"
                TextBox1.Text = "valid"
            Else
                lblOutput.Text = "Some of the required fields are empty"
            End If
        End Sub
      

  4.   

    saucer(思归/MVP) and other friends,thank you a lot,I see what you said,and i really want to validate something at server side.
    I use vs.net 2002 to design my program,but it not work as I expected.
    finally i download vs.net 2003 and redesign my program ,aha ,it work.
    thank you again.