Hi - I posted this message first on GotDotNet, then MSDN, but no one has replied. Alas, the days when MS people were pushing .net so hard that they seemed to be on those sites permanently are gone.
Maybe someone here knows the answer
Subject - Data Grid Template Columns at Run Time
Hi
Suppose I have a data grid set up using HTML containing
templated columns.
<asp:TemplateColumn HeaderText="SMILES (Template)">
<ItemTemplate>
<asp:textbox runat="server" Text='<%# DataBinder.Eval
(Container, "DataItem.ISOSMILES"
%>'></asp:textbox>
</ItemTemplate>
</asp:TemplateColumn>
At run time, a sub gets passed this data grid and wants to
work out the item template in each column. Specifically,
I need to work out which SQL column (ISOSMILES in the
example above) the column is going to try and bind to, if
any.
The reason is I want to remove the column from the data
grid if the particular query I am going to run will not
return that column, so as to avoid an exception.
With a bound column, you get the Datafield property. With
a templated column, I cannot figure out how to access the
ItemTemplate, as all this returns is the ITemplate
interface, which has no useful properties.
Thanks for any suggestions.
Mark
.
Mark![[openup] [openup] [openup]](/data/assets/smilies/openup.gif)
Maybe someone here knows the answer
Subject - Data Grid Template Columns at Run Time
Hi
Suppose I have a data grid set up using HTML containing
templated columns.
<asp:TemplateColumn HeaderText="SMILES (Template)">
<ItemTemplate>
<asp:textbox runat="server" Text='<%# DataBinder.Eval
(Container, "DataItem.ISOSMILES"
</ItemTemplate>
</asp:TemplateColumn>
At run time, a sub gets passed this data grid and wants to
work out the item template in each column. Specifically,
I need to work out which SQL column (ISOSMILES in the
example above) the column is going to try and bind to, if
any.
The reason is I want to remove the column from the data
grid if the particular query I am going to run will not
return that column, so as to avoid an exception.
With a bound column, you get the Datafield property. With
a templated column, I cannot figure out how to access the
ItemTemplate, as all this returns is the ITemplate
interface, which has no useful properties.
Thanks for any suggestions.
Mark
.
Mark
![[openup] [openup] [openup]](/data/assets/smilies/openup.gif)