Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Data Grid Template Columns at Run Time

Reply
Thread Tools

Data Grid Template Columns at Run Time

 
 
Mark
Guest
Posts: n/a
 
      09-25-2003
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run-time template list definition / Run-time variable type definition Pierre Yves C++ 2 01-10-2008 02:52 PM
Problems with dynamic template columns in a data grid =?Utf-8?B?U2ltb24=?= ASP .Net 1 11-22-2007 09:28 AM
template columns and bound columns in gridview Vinki ASP .Net Web Controls 2 04-25-2007 04:22 PM
Exporting data from (All columns in data grid EXCEPT THE 1st) to E =?Utf-8?B?cG11ZA==?= ASP .Net 2 01-10-2005 07:53 PM
How to add columns to a grid dynamically at run time? Ahmet Gunes ASP .Net Web Controls 1 09-15-2003 03:57 PM



Advertisments