Control Render Method Problem and the Visual Studio Designer

P

Pete

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='MaxRestoreWindow(" + 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();
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top