Dynamically create TemplateColumn

G

Guest

Hi there, I cannot write a datagrid on the aspx because i do not know the
names of the column headings until i run a query. So i have to do it
programatically from the datasource.

I have managed to add a couple of boundcolumns based on my datasource easy
peasy but can't find any help anywhere to show me how to dynamically set up
the itemtemplate within a templatecolumn (and add say a checkbox to it). So
what goes after this? I know the syntax is wrong in the following but I cant
find anything close to this in the properties or methods of templatecolumn.
I read another post saying 'new columnTemplate' but cant find this class
anywhere..

TemplateColumn tc = new TemplateColumn();
//want to do the following
ItemTemplate it = new ItemTemplate()
it.Controls.Add(a Checkbox)
tc.Controls.Add(it)
 
G

Guest

Thanks for that. very helpful. however i havent worked out from that how to
add controls such as a checkbox to the itemtemplate. Theres no control
collection or add method anywhere ??
 

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

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top