[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

Access controls inside GridView template at designtime

jdlwright

1/26/2007 5:22:00 AM

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

4 Answers

Nathaniel Greene

1/26/2007 9:31:00 PM

0

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?



"jdlwright@gmail.com" 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
>
>

jdlwright

1/27/2007 2:27:00 AM

0

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
<Nathaniel.Gre...@community.nospam> 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?
>
>
>
> "jdlwri...@gmail.com" 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 -

Thomas Wong

1/31/2007 12:06:00 AM

0

> 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.


jdlwright

2/1/2007 12:02:00 AM

0

On Jan 30, 4:05 pm, "Peter Zolja" <x...@x.com> 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