asp.netvisual-studio-2008checkboxradio-buttondesign-view

Hide Radiobox and Checkbox Name on Visual Studio Design View


I have been designing controls in Visual Studio 2008 and as you may have notice when I use radio button and checkbox web controls for ASP .NET it shows the name on design view, this causes me to see an odd preview because the text are unnecessarily wide. I was wondering if there is any settings in visual studio to turn this off?


Solution

  • I don't think there is a setting in Visual Studio. But here a Solution how you can do it:

    Inherit from CheckBox and assign a new Designer.

    Here a very basic exsample (tested and it works):

    public class MyCheckBoxDesigner : CheckBoxDesigner
    {
        public override string GetDesignTimeHtml()
        {
            return "<input type=checkbox />";
        }
    
    }
    
    [Designer(typeof(MyCheckBoxDesigner))]
    public class MyCheckBox : CheckBox
    {
    
    }