没有图形化显示,继承Control类

using  System;
using  System.Data;
using  System.Configuration;
using  System.Web;
using  System.Web.Security;
using  System.Web.UI;
using  System.Web.UI.WebControls;
using  System.Web.UI.WebControls.WebParts;
using  System.Web.UI.HtmlControls;

/// <summary>
/// TestRender 的摘要说明
/// </summary>

namespace  USERControls
{
    
public class TestRender : System.Web.UI.Control
    
{
        
public TestRender()
        
{
            
//
            
// TODO: 在此处添加构造函数逻辑
            
//
        }



        
protected override void Render(HtmlTextWriter writer)
        
{

            writer.AddAttribute(HtmlTextWriterAttribute.Href, 
"http://www.163.com");

            writer.AddStyleAttribute(HtmlTextWriterStyle.Color, 
"red");

            writer.RenderBeginTag(HtmlTextWriterTag.A);

            writer.Write(
"dd");

            writer.RenderEndTag();

           
            
            
base.Render(writer);
        }

    }

}

你可能感兴趣的:(继承)