<% @ page language="c#" %>
<script language="c#" runat="server">
public void button(Object sender,CommandEvenArgs e){
string action1=e.CommandName;
string action2=e.CommandArgument.ToString();
nns.Text="您的动作是"+action1+"动作对象是"+action2;
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<form runat="server">
<asp:Button id="button1"  CommandName="踢"  CommandArgument="足球" Text="动作1" runat="server" OnCommand="button" />
<asp:Button id="button2"  CommandName="打"  CommandArgument="篮球" Text="动作2" runat="server"  OnCommand="button" />
<asp:Label id="nns" runat="server" />
</form>
</body>
</html>
==============================
错误信息是:
========================
Server Error in '/nns' Application.
--------------------------------------------------------------------------------Compilation Error 
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0246: The type or namespace name 'CommandEvenArgs' could not be found (are you missing a using directive or an assembly reference?)Source Error: Line 1:  <% @ page language="c#" %>
Line 2:  <script language="c#" runat="server">
Line 3:  public void button(Object sender,CommandEvenArgs e){
Line 4:   string action1=e.CommandName;
Line 5:   string action2=e.CommandArgument.ToString();
 Source File: g:\aspnet\samples\button2.aspx    Line: 3 Show Detailed Compiler Output:
d:\windows\system32\inetsrv> "D:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\csc.exe" /t:library /utf8output /R:"D:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.3600.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"D:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.3600.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"D:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\mscorlib.dll" /R:"D:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.3600.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"D:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.3600.0__b77a5c561934e089\System.Xml.dll" /R:"D:\WINDOWS\assembly\GAC_32\System.Data\2.0.3600.0__b77a5c561934e089\System.Data.dll" /R:"D:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.3600.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"D:\WINDOWS\assembly\GAC_MSIL\System.Web\2.0.3600.0__b03f5f7f11d50a3a\System.Web.dll" /R:"D:\WINDOWS\assembly\GAC_MSIL\System\2.0.3600.0__b77a5c561934e089\System.dll" /out:"D:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\Temporary ASP.NET Files\nns\1d542f7b\5b2ff2b9\xsdijgao.dll" /D:DEBUG /debug+ /optimize- /warnaserror /w:1 /nowarn:1659  "D:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\Temporary ASP.NET Files\nns\1d542f7b\5b2ff2b9\xsdijgao.0.cs" "D:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\Temporary ASP.NET Files\nns\1d542f7b\5b2ff2b9\xsdijgao.1.cs"
Microsoft (R) Visual C# .NET Compiler version 8.00.40607.42
for Microsoft (R) Windows (R) .NET Framework version 2.0.40607
Copyright (C) Microsoft Corporation 2001-2003. All rights reserved.g:\aspnet\samples\button2.aspx(3,34): error CS0246: The type or namespace name 'CommandEvenArgs' could not be found (are you missing a using directive or an assembly reference?) Show Complete Compilation Source:
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.40607.42; ASP.NET Version:2.0.40607.42 

解决方案 »

  1.   

    public void button(Object sender,CommandEvenArgs e)
    改成public void button(Object sender, System.EvenArgs e)
      

  2.   

    CommandEventArgs 参数类型错误!
    应该是EventArgs
      

  3.   

    椰子老哥,我按照这个改动了Compiler Error Message: CS0234: The type or namespace name 'EvenArgs' does not exist in the namespace 'System' (are you missing an assembly reference?)Source Error: Line 1:  <% @ page language="c#" %>
    Line 2:  <script language="c#" runat="server">
    Line 3:  public void button(Object sender, System.EvenArgs e){
    Line 4:   string action1=e.CommandName;
    Line 5:   string action2=e.CommandArgument.ToString();
     
    还不可以阿。还是那个错误
      

  4.   

    name 'EvenArgs' 
    少t
    EventArgs
      

  5.   

    <% @ page language="c#" %>
    <script language="c#" runat="server">public void doupload(Object src,EventArgs e){
    int num=Request.Files.Count;
    char[] aa={'\\'};
    string dirfilename;
    string[] strfilename;
    for(int i=0;i<num;i++){
    HttpPostedFile htf=Request.Files[i];
    strfilename=htf.FileName.Split(aa);
    dirfilename=strfilename[strfilename.Length-1];
    htf.SaveAs(Server.MapPath(".")+"\\"+dirfilename);
    Addpanelcontrols(dirfilename);
    }
    }
    public void Addpanelcontrols(string filename){
    Label lblshow=new Label();
    lblshow.Text=filename+"上传成功";
    Panel1.Controls.Add(lblshow);
    }
    </script>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    </head>
    <body>
    <form Enctype="multipart/form-data" runat="server">
    <input type="file" runat="server" id="uploadfile1"><br>
    <input type="file" runat="server" id="uploadfile2"><br>
    <input type="file" runat="server" id="uploadfile3"><br>
    <input type="file" runat="server" id="uploadfile4"><br>
    <input type="file" runat="server" id="uploadfile5"><br>
    <input type="file" runat="server" id="uploadfile6"><br>
    <input type="submit" OnServerClick="doupload" value="开始上传" runat="server"><br></form>
    <hr>
    <asp:Panel id="Panel1" runat="server" />
    </body>
    </html>
    ============================
    错误是
    ==========================
    Server Error in '/nns' Application.
    --------------------------------------------------------------------------------Could not find a part of the path 'G:\aspnet\samples\'. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'G:\aspnet\samples\'.Source Error: 
    Line 11:  strfilename=htf.FileName.Split(aa);
    Line 12:  dirfilename=strfilename[strfilename.Length-1];
    Line 13:  htf.SaveAs(Server.MapPath(".")+"\\"+dirfilename);
    Line 14:  Addpanelcontrols(dirfilename);
    Line 15:  }
     Source File: g:\aspnet\samples\multiupload.aspx    Line: 13 Stack Trace: 
    [DirectoryNotFoundException: Could not find a part of the path 'G:\aspnet\samples\'.]
       System.IO.__Error.WinIOError(Int32 errorCode, String str) +1479842
       System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +935
       System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +112
       System.IO.FileStream..ctor(String path, FileMode mode) +52
       System.Web.HttpPostedFile.SaveAs(String filename) +92
       ASP.multiupload_aspx.doupload(Object src, EventArgs e) in g:\aspnet\samples\multiupload.aspx:13
       System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e) +111
       System.Web.UI.HtmlControls.HtmlInputButton.RaisePostBackEvent(String eventArgument) +79
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +31
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5157 
    这个市那里出问题了呢,我写了一个单个上传得文件可以,多个上传久不行了。就抱这个错