In our control by modifying the phase of rendering at run-time by inserting a Javascript that outputs the HTML.
protected override void Render (HtmlTextWriter output) {
output.Write (" );}
create the class for design-time rendering.
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);}
}
Finally bind the control to the class of DesignTime.
[Designer ("ControlloConDesignTime.DesignTime")] public class
ControlloCon: {System.Web.UI.WebControls.WebControl