Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone care to beat MSDN and GotDotNet?

Status
Not open for further replies.

Custom24

Programmer
Nov 27, 2001
591
GB
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=&quot;SMILES (Template)&quot;>
<ItemTemplate>
<asp:textbox runat=&quot;server&quot; Text='<%# DataBinder.Eval
(Container, &quot;DataItem.ISOSMILES&quot;) %>'></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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top