Access controls inside GridView template at designtime

Discussion in 'ASP .Net Building Controls' started by jdlwright@gmail.com, Jan 26, 2007.

  1. Guest

    Hi, I need my control to access other controls that are located in the
    ItemTemplate of a GridView - at designtime.

    I had success in the past with DataGrid, doing this by calling
    FindControl at design-time - however it doesn't work with GridView.

    So basically in the EditValue method of my UITypeEditor I would access
    the DataGrid with FindControl and then call FindControl on it to get at
    the control I was after.

    Is there anyway to access controls that are in a GridView template?

    Many thanks,
    Jim
    , Jan 26, 2007
    #1
    1. Advertising

  2. Obvious question, but have you had your designer check your control's Parent
    ? and see who it is and then iterate until you've found your ItemTemplate?



    "" wrote:

    > Hi, I need my control to access other controls that are located in the
    > ItemTemplate of a GridView - at designtime.
    >
    > I had success in the past with DataGrid, doing this by calling
    > FindControl at design-time - however it doesn't work with GridView.
    >
    > So basically in the EditValue method of my UITypeEditor I would access
    > the DataGrid with FindControl and then call FindControl on it to get at
    > the control I was after.
    >
    > Is there anyway to access controls that are in a GridView template?
    >
    > Many thanks,
    > Jim
    >
    >
    Nathaniel Greene, Jan 26, 2007
    #2
    1. Advertising

  3. Guest

    Thanks for replying - unfortunately I have tried looking at Parent - it
    only contains my control and the GridView. As far as I can see,
    there's no way to access the ItemTemplate, as it's not listed in
    GridView.Controls (in fact, GridView.Controls.Count==0).




    On Jan 26, 1:31 pm, Nathaniel Greene
    <> wrote:
    > Obvious question, but have you had your designer check your control's Parent
    > ? and see who it is and then iterate until you've found your ItemTemplate?
    >
    >
    >
    > "" wrote:
    > > Hi, I need my control to access other controls that are located in the
    > > ItemTemplate of a GridView - at designtime.

    >
    > > I had success in the past with DataGrid, doing this by calling
    > > FindControl at design-time - however it doesn't work with GridView.

    >
    > > So basically in the EditValue method of my UITypeEditor I would access
    > > the DataGrid with FindControl and then call FindControl on it to get at
    > > the control I was after.

    >
    > > Is there anyway to access controls that are in a GridView template?

    >
    > > Many thanks,
    > > Jim- Hide quoted text -- Show quoted text -
    , Jan 27, 2007
    #3
  4. Peter Zolja Guest

    > Hi, I need my control to access other controls that are located in the
    > ItemTemplate of a GridView - at designtime.


    Does it work at runtime? I mean, can you find other controls in the
    ItemTemplate when you run the application? Could you post a small test
    program? (A lot of times just building a small test program helps you find
    the solution :)

    Peter.
    Peter Zolja, Jan 31, 2007
    #4
  5. Guest

    On Jan 30, 4:05 pm, "Peter Zolja" <> wrote:
    > > Hi, I need my control to access other controls that are located in the
    > > ItemTemplate of a GridView - at designtime.

    >
    > Does it work at runtime? I mean, can you find other controls in the
    > ItemTemplate when you run the application? Could you post a small test
    > program? (A lot of times just building a small test program helps you find
    > the solution :)
    >
    > Peter.


    You're right it does usually help, Peter. I've had to give up on this
    and assume it's just down to the difference between .NET 1's DataGrid
    and GridView. Logically I'm unsure why DataGrid _would_ provide the
    controls in it's template via FindControl at design time, I guess it
    was just a happy side-effect of how it was made - and I have no reason
    to expect the same from GridView. Nevermind, I made a compromise
    instead.

    Thanks though,
    Jim
    , Feb 1, 2007
    #5
    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. Chip
    Replies:
    1
    Views:
    388
  2. Mike

    Refreash DesignTime control.

    Mike, Jan 11, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    418
  3. Varangian
    Replies:
    7
    Views:
    568
    Varangian
    Apr 27, 2006
  4. wikkiwikkiwaa
    Replies:
    2
    Views:
    12,562
    wikkiwikkiwaa
    Aug 9, 2006
  5. Alessandro Zifiglio

    Deleting controls at designtime in web Custom templated control

    Alessandro Zifiglio, Dec 13, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    145
    Alessandro Zifiglio
    Dec 13, 2003
Loading...

Share This Page