×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

总算等到了高手,多谢指点!

本文发表在 rolia.net 枫下论坛是这样子:我想试一下WEB FORM component,像button和datagrid等,顺手画了两个,运行后没有显示,而HTML的component却可以显示出来,不知道哪里出了问题。多谢!

cs文件如下:

public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button1;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion
}



HTML文件如下:

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="Pick.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<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">
<DIV style="DISPLAY: inline; Z-INDEX: 101; LEFT: 24px; WIDTH: 70px; POSITION: absolute; TOP: 39px; HEIGHT: 15px" ms_positioning="FlowLayout">Label</DIV>
<INPUT style="Z-INDEX: 102; LEFT: 103px; POSITION: absolute; TOP: 38px" type="text">
<asp:TextBox id="TextBox1" style="Z-INDEX: 103; LEFT: 16px; POSITION: absolute; TOP: 97px" runat="server" Width="105px" Height="27px"></asp:TextBox>
<asp:Button id="Button1" style="Z-INDEX: 104; LEFT: 128px; POSITION: absolute; TOP: 95px" runat="server" Width="125px" Height="32px" Text="Button"></asp:Button>
</form>
</body>
</HTML>更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / 问一个ASP .NET中WEB FORM Component不能显示的问题
    正在学习ASP .NET,有一个问题问大家:HTML的Component可以正常显示,但WEB FORM却不能,是不是有什么设定我需要做?谢谢大家的回答!另外,我用的是Visual C# .Net。
    • 帖.cs上来。不愿帖就问得清楚点
      • 总算等到了高手,多谢指点!
        本文发表在 rolia.net 枫下论坛是这样子:我想试一下WEB FORM component,像button和datagrid等,顺手画了两个,运行后没有显示,而HTML的component却可以显示出来,不知道哪里出了问题。多谢!

        cs文件如下:

        public class WebForm1 : System.Web.UI.Page
        {
        protected System.Web.UI.WebControls.TextBox TextBox1;
        protected System.Web.UI.WebControls.Button Button1;

        private void Page_Load(object sender, System.EventArgs e)
        {
        // Put user code to initialize the page here
        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
        //
        // CODEGEN: This call is required by the ASP.NET Web Form Designer.
        //
        InitializeComponent();
        base.OnInit(e);
        }

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
        this.Load += new System.EventHandler(this.Page_Load);

        }
        #endregion
        }



        HTML文件如下:

        <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="Pick.WebForm1" %>
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
        <HTML>
        <HEAD>
        <title>WebForm1</title>
        <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
        <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">
        <DIV style="DISPLAY: inline; Z-INDEX: 101; LEFT: 24px; WIDTH: 70px; POSITION: absolute; TOP: 39px; HEIGHT: 15px" ms_positioning="FlowLayout">Label</DIV>
        <INPUT style="Z-INDEX: 102; LEFT: 103px; POSITION: absolute; TOP: 38px" type="text">
        <asp:TextBox id="TextBox1" style="Z-INDEX: 103; LEFT: 16px; POSITION: absolute; TOP: 97px" runat="server" Width="105px" Height="27px"></asp:TextBox>
        <asp:Button id="Button1" style="Z-INDEX: 104; LEFT: 128px; POSITION: absolute; TOP: 95px" runat="server" Width="125px" Height="32px" Text="Button"></asp:Button>
        </form>
        </body>
        </HTML>更多精彩文章及讨论,请光临枫下论坛 rolia.net
        • 顺手画了两个again. exactly following `hello word!` one step by one step. do u access your .aspx from iis?
          • 通过IIS访问了,只有HTML的可以显示,WEB FORM不能,是不是还有其他设置在explorer?多谢!
          • 另外,我试了一个MS的例子从网上运行,可以显示十行Welcome to ASP.NET,而同样的ASPX在LOCAL的IIS运行只显示一行,不知什么缘故。例子在内。谢谢!
            <%@ Page Language="C#"%>

            <html>
            <head>
            <link rel="stylesheet"href="intro.css">
            </head>

            <body>

            <center>

            <form action="intro2.aspx" method="post">

            <h3> Name: <input id="Name" type=text>

            Category: <select id="Category" size=1>
            <option>psychology</option>
            <option>business</option>
            <option>popular_comp</option>
            </select>

            </h3>

            <input type=submit value="Lookup">

            <p>

            <% for (int i=0; i <8; i++) { %>
            <font size="<%=i%>"> Welcome to ASP.NET </font> <br>
            <% }%>

            </form>

            </center>

            </body>
            </html>
        • <asp:TextBox id="TextBox1" RUNAT="SERVER"></asp:TextBox> <asp:Button id="Button1" RUNAT="SERVER"></asp:Button>
    • 应该是IIS设置的问题 -- http://localhost是不是正常? 有没有设置用什么程序打开.ASPX文件? (WIN2K不自动识别.ASPX)
      • 是WinXP,http://localhost/没有问题,IIS已经启动,回家再试!多谢!
    • install IIS - install vistual studio - open vistual studio - create C# web app project - drap&drop some web/ html controls - press f5. this is dummy work, 还没搞定?!
    • what's version of your IIS? If it is 6.0, you need to allow asp.net web service extension
      • Version5.1,看样子我得升级,谢谢这位朋友!
        • 与时俱进,嘿嘿
    • run aspnet_regiis.exe under WINNT\Mirosoft.Net\Framework\[FrameworkVersion]
      • 上班没空试,这是副业,回家再踹。谢谢!