Casting user Control in Grid

Discussion in 'ASP .Net' started by Shimon Sim, Aug 30, 2005.

  1. Shimon Sim

    Shimon Sim Guest

    Hi
    I create user control to EditTemplate in DataGrid control
    I need to cast to get correct type of the control like this

    MyBox box=(MyBox) e.Item.Cells[0].Controls[0];
    Usually if I need to add
    protected MyBox idofcontrol;
    Where I need to know exact id of the control. The is impossible with
    DataGrid.
    Any ideas how this can be done?
    Thank you.
    Shimon.
     
    Shimon Sim, Aug 30, 2005
    #1
    1. Advertising

  2. Shimon Sim

    Shimon Sim Guest

    OK. I found easy solution. FindControl() works just fine.
    Thanks.
    Shimon.
    "Shimon Sim" <> wrote in message
    news:...
    > Hi
    > I create user control to EditTemplate in DataGrid control
    > I need to cast to get correct type of the control like this
    >
    > MyBox box=(MyBox) e.Item.Cells[0].Controls[0];
    > Usually if I need to add
    > protected MyBox idofcontrol;
    > Where I need to know exact id of the control. The is impossible with
    > DataGrid.
    > Any ideas how this can be done?
    > Thank you.
    > Shimon.
    >
    >
     
    Shimon Sim, Aug 30, 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. Mad Scientist Jr
    Replies:
    0
    Views:
    674
    Mad Scientist Jr
    Mar 22, 2006
  2. kevin
    Replies:
    11
    Views:
    5,840
    Andrew McDonagh
    Jan 8, 2005
  3. Wally Barnes
    Replies:
    3
    Views:
    545
    Wally Barnes
    Nov 20, 2008
  4. Sosuke

    Up casting and down casting

    Sosuke, Dec 20, 2009, in forum: C++
    Replies:
    2
    Views:
    595
    James Kanze
    Dec 20, 2009
  5. et

    Casting a grid

    et, Jan 31, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    112
Loading...

Share This Page