Custom DataGrid Control - problem with adding BoundColumn

M

Michael Tanner

I have created a custom control that derives from a DataGrid:
public class SelectableDataGridControl : System.Web.UI.WebControls.DataGrid

I have overloaded the DataBind method and adding a custom DataGridColumn:
public override void DataBind()
{
base.Columns.AddAt(0, sdg);
base.DataBind ();
}

Adding my custom datagrid to a webform works perfectly as long as I leave
the AutoGenerateColumns set to true. I need to set this property to false
and add a few BoundColumns. When I add BoundColumns to the custom datagrid
via the Columns property in the designer, the columns are added to the
datagrid in the Design View; however, the columns are not added to the html,
thus they do not appear when viewed in the browser. The only column
displayed is the special column that I add in the overloaded DataBind
method.

How can I get the designer to generate the BoundColumn html at design time?
Any ideas are greatly appreciated!
 

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,822
Latest member
israfaceZa

Latest Threads

Top