Problem with ControlDesigner and GetDesignTimeHtml

N

Nicolas LeBlanc

Hello,

I'm trying to do a control that does an html table around other controls, it
works 100% fine, but I have decided to implement design time viewing, now
I'm in trouble.

It works, but it does not render any nested controls inside my control
(which inherits from a Panel), so no child controls are rendered in design
time at all.

Of course, if I don't use a designer, I have the standard Panel behavior,
but this is not what I want, I want to see my html table rendered and the
content inside the panel rendered too.

There are very few examples on the web, and I have yet to see anybody doing
a GetDesignTimeHtml method that, for exemple, render a datagrid inside it...

Can anybody help? This is not really needed, but design time viewing is
pretty useful.

Thanks.
 
D

Dale

You can use the DataGridDesigner class to provide functionality similar to
the default designer action in Visual Studio.

If you just want to render a simulation of a DataGrid, you should emulate
the HTML that is rendered to the browser by ASP.NET. Something I do is to
open the source view of the control as rendered in a browser, and then wrap
the rendered HTML in a StringBuilder or TextWriter to collect the HTML and
return it as the result of the GetDesignTimeHtml.

You can use the GetDesignTimeDataSource to return a collection that can be
used to provide designtime data for your datagrid.


Dale Preston
MCAD, MCSE, MCDBA
 

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,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top