protected override void Render(HtmlTextWriter output){
output.Write("");
}
creiamo la classe per il rendering a design-time.
public class DesignTime : ControlDesigner{
ControlloCon FControllo;
public override void Initialize(System.ComponentModel.IComponent component){
this.FControllo = (ControlloCon)component;
base.Initialize(component);
}
public override string GetDesignTimeHtml() {
try{
if (FControllo.Text == string.Empty)
return GetEmptyDesignTimeHtml();
else
return "
" + FControllo.Text + " |
}
catch(Exception ex){
return GetErrorDesignTimeHtml(ex);
}
}
protected override string GetEmptyDesignTimeHtml(){
return "
" + typeof(ControlloCon) + " " + FControllo.ID + " |
}
protected override string GetErrorDesignTimeHtml(Exception e){
return CreatePlaceHolderDesignTimeHtml(e.Message);
}
}
Infine associamo il controllo alla classe di DesignTime.
[Designer("ControlloConDesignTime.DesignTime")]
public class ControlloCon: System.Web.UI.WebControls.WebControl{
Nessun commento:
Posta un commento