Rendering DataGrid in a custom control at design time

S

Sam Fields

I have built custom controls that inherit from the HtmlTable control so that
they will render properly at design time. I am using a designer, since for
some reason an Html control without a designer gives ID problems. My
designer is simple:

internal class StandardHtmlControlDesigner : ControlDesigner
{
public override string GetDesignTimeHtml()
{
return base.GetDesignTimeHtml();
}
}

This works very well. Also, when building the inherited controls
themselves, I am using the following directives:

[Designer(typeof(Design.StandardHtmlControlDesigner), typeof(IDesigner))]
[PersistChildren(false)]
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
[ParseChildren(true)]

So that it will properly parse and render the children with the custom table
is rendered. This renders every control correctly, EXCEPT the datagrid
control. I want to use the .NET <asp:DataGrid>, but for some reason the
CreateControlHierarchy(false) is never called during the rendering of the
datagrid. The is not affecting the browser output, I just want it to render
at design time properly with the columns filled out like a default DataGrid
control would be (with 5 rows, and "DataBound" rendered in the databound
columns).

Can anyone tell me how to hook into the DataGrid control (I'm assuming via
my designer) to tell it to create the non-bound control hierarchy?

Thanks!
Sam Fields
 

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

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top