Getting inside a template column

Discussion in 'ASP .Net' started by G Dean Blake, Jan 19, 2005.

  1. G Dean Blake

    G Dean Blake Guest

    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
    G Dean Blake, Jan 19, 2005
    #1
    1. Advertising

  2. Try going one level further:

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

    Eliyahu

    "G Dean Blake" <> wrote in message
    news:Oyk0Hbl$...
    > 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
    >
    >
    Eliyahu Goldin, Jan 20, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dexter
    Replies:
    1
    Views:
    417
    Eliyahu Goldin
    Jan 18, 2005
  2. Ken Varn
    Replies:
    1
    Views:
    974
    Ken Varn
    Aug 19, 2005
  3. Charleees
    Replies:
    2
    Views:
    8,205
    Eliyahu Goldin
    Jun 20, 2006
  4. Ravichandran Mahalingam

    Bound Column or Template Column (w dAdapater?) in DataGrid

    Ravichandran Mahalingam, Jan 9, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    220
    Ravichandran Mahalingam
    Jan 9, 2004
  5. G Dean Blake

    Getting inside a template column

    G Dean Blake, Jan 19, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    112
    G Dean Blake
    Jan 19, 2005
Loading...

Share This Page