net2.0如何以编程方式创建完整的web页
下为 default.aspx 文件内容
<%@ Page language= "c# " AutoEventWireup= "false " Inherits= "mynamespace.mypage " Codebehind= "Class.cs " %>
下为 App_Code/class的全部内容
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace mynamespace
{
public class mypage : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
HtmlForm myform = new HtmlForm();
myform.ID = "output ";
Label mylabel = new Label();
mylabel.Text = "yes ";
myform.Controls.Add(mylabel);
this.Controls.Add(myform);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
这样运行结果是:
<form name= "output " method= "post " action= "Default.aspx " id= "output ">
<div>
<input type= "hidden " name= "__VIEWSTATE " id= "__VIEWSTATE " value= "/wEPDwUENTM4MWRkQxQtTiBEq2XtRBwFEvaW/ntnhy4= " />
</div>
<span> yes </span> </form>
显然没有 <html> 和 <body>
如何改写这段代码才能有 <html> 和 <body> 出现在输出中?
------解决方案--------------------没搞过asp.net,不过看了点书,可以重写Render方法~~~
protec