Ask a Question related to ASP.NET Building Controls, Design and Development.
-
Pete #1
Control Render Method Problem and the Visual Studio Designer
Hello List,
I have a web control library that has both Render and OnPreRender methods.
My problem is that when I drag and drop my control onto
the designer in Visual Studio my control shows up as very tiny green arrow.
Obviously the VS designer is trying to add any HTML
attributes to the properties window, but in my case I have none. I'm just
want the HtmlTextWriter to spit out lines of DHTML. My
render method is below. I've search through the docs System.ComponetModel
attributes and can't find what I need to completely hide
my Render method from the VS designer. My control works flawlessly but I
need it show up correctly at design time. If I completely
rip out the Render method my control shows up in the VS designer as it
should. I've also added my designer class for my control.
Thanks in advance.
#region Render Method
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void Render(HtmlTextWriter writer)
{
base.Render (writer);
String topBC = this.TopBarColor.ToKnownColor().ToString();
String btnISD = this.BtnImagesSrcDirectory;
writer.WriteLine("<div
id='docWindow'style='position:absolute;background-color:#000000;left:0px;top
:0px;display:none'>");
if (TopBarVisible == true)
{
writer.WriteLine("<div align='right'style='background-color:" + topBC +
"'><img src='" + btnISD +
"Maximize.gif'id='maxRestoreWindow'onClick='MaxRes toreWindow(" + btnISD +
")'><img src='" + btnISD +
"Close.gif'onClick='CloseWindow()'></div>");
}
writer.WriteLine("<iframe id='fooiFrame' src='' width=100%
height=100%></iframe></div>");
}
#endregion Render Method
public class TheControlDesigner : ControlDesigner
{
protected override string GetEmptyDesignTimeHtml()
{
StringBuilder sb = new StringBuilder("");
sb.Append("<table bgcolor=Green<tr><td align=center>");
sb.Append("<span style='font-family:verdana;font-size:10px;'>");
sb.Append("test <b>test</b>Control</span>");
sb.Append("</td></tr><tr><td align=center>");
sb.Append("<span style='font-family:verdana;font-size:10px;'>");
sb.Append("Courtesy of <b>test</b></span>");
sb.Append("</td></tr></table>");
return sb.ToString();
}
}
Pete Guest
-
User Control not rendered in Visual Studio
I have created a custom composite server control. When I drag the control from the toolbox into Visual Studio it does not display in Visual Studio,... -
Visual Studio doesn't reflect a new property name for a derived control
Hi, I have been working on a control derived from DropDownList called CodeDescDropDown. Initially, I created a property called SortField to... -
Problem overriding render method to format literal content of nested tags in custom control
Peter, I was under the mistaken impression that I was already overriding CreateChildControls to create the controls with the code: protected... -
Visual Studio.NET 2003 generates type object[] for ArrayList method return
I've noticed what appears to be a bug in the Visual Studio.NET (1.0 and 2003 versions). If I declare a web method like so: public ArrayList... -
Subclassing UserControl makes the Visual Studio designer does not work
I want to subclass the System.Web.UI.UserControl to make a common control for my site. Then, when I create a new UserControl from the Visual Studio...



Reply With Quote

