资 源 简 介
Control Adapters
The most basic implementation if you are looking to start on control adapters this is perfect for you.
Mostly 10 lines of code which makes it all work for a label to be re-rendered into users browser.
//----------------------------------------------------------------------------------------
//LabelAdapter.cs (class file)
//----------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace JB.Adapters
{
public class LabelAdapter : System.Web.UI.Adapters.ControlAdapter
{
protected override void Render(HtmlTextWriter writer)
{
Label l = Control as Label;
writer.WriteLine();
writer.WriteBeginTag("label");