这是我的第一个aspx程序,不知为何就是不能显示出Label1。
body中的代码:
<script language="C#" runat="server">
  void Page_Load(object Source,EventArgs E)
  {
    Label1.Text="Test";
  }
</script>
<asp:Label ID="Label1" Runat="server"/>

解决方案 »

  1.   

    有IIS没有?安装ASP.NET了么?你把文件拷贝到IIS的某个目录里了么?还有,看是否正确注册ASP.NET了%windir%\Microsoft.NET\Framewo&shy;rk\v1.1.4322 -i
      

  2.   

    应该都装了的吧,我用的vs2003,按F5编译执行的,如果出错它也会报错的。
      

  3.   

    应该显示"Test"的<script language="C#" runat="server">
      void Page_Load(object Source,EventArgs E)
      {
        Label1.Text="Test" + DateTime.Now.ToString();
      }
    </script>
    <html><body>
    <asp:Label ID="Label1" Runat="server"/>
    </body></html>
      

  4.   

    确实应该啊,我使用<%=DateTime.Now%>都可以显示结果的。
      

  5.   

    <%@ Page language="C#" AutoEventWireup="true"   ...   %>
      

  6.   

    哦,可以了。
    将AutoEventWireup="flase" 改成true就行了。
    谢谢,这个true和flase有什么意义?
      

  7.   

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconPage.asp
    AutoEventWireup 
    Indicates whether the page's events are autowired. true if event autowiring is enabled; otherwise, false. The default is true. For more information, see Web Server Control Event Model.