Take a look at the ITemplate interface definition, it should show you the
way.
"Richard" <> wrote in message
news: om...
> I want to do the following:
>
> // create the template column ...
> TemplateColumn tc = new TemplateColumn();
> tc.HeaderText = "Location";
> tc.HeaderStyle.Width = Unit.Percentage(40);
>
> // create a label for the item template ...
> label = new Label();
> label.ID = "lbl" + Tree + "Location";
> label.Text = "<%# DataBinder.Eval(Container.DataItem, 'Location') %>";
>
> // Add the label to the template column
> ??? The unlike the dataGrid.Columns, the template column has no
> Add method so how do I add the control ???
>
> dataGrid.Columns.Add(tc);
>
>
> The area where the ??? are is where I need help. Any help would be
appreciated.
>
> Thanks
|