回 帖 发 新 帖 刷新版面

主题:[讨论]请高手指导该程序有什么问题?


[b][color=FF0000]MyCodeBehind.cs[/color][/b]
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;


namespace WebApplication5

    public class MyClass:System.Web.UI.Page

    {
        protected System.Web.UI.WebControls.Label Label1;
        protected System.Web.UI.WebControls.Button Button1;
        protected System.Web.UI.WebControls.TextBox TextBox1;

        public void Button1_Click(Object sender,EventArgs e)
        {
            Label1.Text="Hello, "+TextBox1.Text.ToString();
        }
    }
}



[b][color=FF0000]MyCodeBehind.aspx[/color][/b]
<%@ Page Language="c#"  Inherits="WebApplication5.MyClass"  AutoEventWireup="false"  Src="MyCodeBehind.cs" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>WebForm2</title>
        <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" Content="C#">
        <meta name="vs_defaultClientScript" content="JavaScript">
        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <FONT face="宋体">
                <asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 216px; POSITION: absolute; TOP: 128px" runat="server"
                    Width="96px" Height="32px">Label</asp:Label>
                <asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 216px; POSITION: absolute; TOP: 192px"
                    runat="server" Width="112px" Height="40px"></asp:TextBox>
                <asp:Button id="Button1" style="Z-INDEX: 103; LEFT: 216px; POSITION: absolute; TOP: 272px" Width="88px"
                    Height="40px" Text="确定" OnClick="Button1_Click" runat="server"></asp:Button>
            </FONT>
        </form>
    </body>
</HTML>

回复列表 (共4个回复)

沙发

程序并没有什么问题?

板凳

但执行就会出如下错误:

“/WebApplication5”应用程序中的服务器错误。
--------------------------------------------------------------------------------

编译错误 
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 

编译器错误信息: CS1595: 已在多处定义“WebApplication5.MyClass”;使用“c:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\webapplication5\a30da259\706283c7\akxu5ufn.dll”中的定义

源错误:

 

行 27:     
行 28:     [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
[color=FF0000]行 29:     public class MyCodeBehind_aspx : WebApplication5.MyClass, System.Web.SessionState.IRequiresSessionState {[/color]
行 30:         
行 31:         
 

源文件: c:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\webapplication5\a30da259\706283c7\-tfrojsr.0.cs    行: 29 

3 楼

很难吗?尽然无人能回答!

4 楼

给了程序跟没没给有什么区别么?

我来回复

您尚未登录,请登录后再回复。点此登录或注册