Getting inside a template column

G

G Dean Blake

I'm writing a Grid Print component and I am being passed a datagrid. I have
to take apart the various columns in order to print them.

In the case where the grid had a template column that is a text box, I am
finding that myItem.Cells(i).Controls(0).GetType.Name gets "LiteralControl".

I can't seem to find out how to tell what kind of control it is i.e.
dropdownlist, textbox etc. I suppose I could try casting it as a textbox to
see if it throws an exception but I don't want to do that as it would slow
things down.

Anyone know how to see what kind of control it is?
Thanks,
G
 
E

Eliyahu Goldin

Try going one level further:

myItem.Cells(i).Controls(0).Controls(0).GetType.Name

Eliyahu
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top