Get control

Get control

am 10.01.2008 04:00:52 von Shapper

Hello,

I have a control inside a custom control. The control tree is has
follows:

ListView > EditItemTemplate > CustomControl A > CustomControl B >
Literal

I need to bind the Literal so I did the following:

Dim lvdiContainer As ListViewDataItem =
CType(myLiteral.NamingContainer, ListViewDataItem)

This does not work because myLiteral.NamingContainer returns Custom
Control B.

If I have the following control tree it works:

ListView > EditItemTemplate > Literal

Could someone, please, tell me how to solve this problem?

Thanks,
Miguel

Re: Get control

am 10.01.2008 10:13:08 von JonMYates

On 10 Jan, 03:00, shapper wrote:
> Hello,
>
> I have a control inside a custom control. The control tree is has
> follows:
>
> ListView =A0> =A0EditItemTemplate > CustomControl A > CustomControl B >
> Literal
>
> I need to bind the Literal so I did the following:
>
> Dim lvdiContainer As ListViewDataItem =3D
> CType(myLiteral.NamingContainer, ListViewDataItem)
>
> This does not work because myLiteral.NamingContainer returns Custom
> Control B.
>
> If I have the following control tree it works:
>
> ListView =A0> =A0EditItemTemplate > =A0Literal
>
> Could someone, please, tell me how to solve this problem?
>
> Thanks,
> Miguel

Hello Miguel,

Could you set the value of your litreral from within Control B. For
example on the OnLoad or PreRender event?

Jon

www.nantwichonline.com

Re: Get control

am 10.01.2008 19:25:03 von Shapper

On Jan 10, 9:13 am, Jon wrote:
> On 10 Jan, 03:00, shapper wrote:
>
>
>
> > Hello,
>
> > I have a control inside a custom control. The control tree is has
> > follows:
>
> > ListView > EditItemTemplate > CustomControl A > CustomControl B >
> > Literal
>
> > I need to bind the Literal so I did the following:
>
> > Dim lvdiContainer As ListViewDataItem =
> > CType(myLiteral.NamingContainer, ListViewDataItem)
>
> > This does not work because myLiteral.NamingContainer returns Custom
> > Control B.
>
> > If I have the following control tree it works:
>
> > ListView > EditItemTemplate > Literal
>
> > Could someone, please, tell me how to solve this problem?
>
> > Thanks,
> > Miguel
>
> Hello Miguel,
>
> Could you set the value of your litreral from within Control B. For
> example on the OnLoad or PreRender event?
>
> Jon
>
> www.nantwichonline.com

Hi,

I can't do that. This is inside a ListView Item template.

I tried the following:

Dim lvdiContainer As ListViewDataItem =
CType(lText.Parent.Parent.NamingContainer, ListViewDataItem)

I keep having the same error.

Thanks,
Miguel