Depending what template is the default at the time of call, one of these
should work:
Label DateConfirmLabel = (Label)EditNewsForm.FindControl("DateLabel");
or
Label DateConfirmLabel =
(Label)EditNewsForm.EditItemTemplate.FindControl("DateLabel");
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Andy B" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have 2 TextBoxes and a Label inside the EditItemTemplate of a formView
>(the EditItemTemplate is the only template it has). I need to access the
>properties of the Label and TextBox controls elsewhere on the page. How do
>you do something like that? I tried probably just about everything I can
>think of. I tried this line of code but I keep getting a null reference
>exception.
>
> Label DateConfirmLabel =
> (Label)EditNewsForm.Controls[0].FindControl("DateLabel");
>
>
>
> The really strange thing, this worked when I needed my Menu from the
> masterPage:
>
>
>
> Menu MainMenu = (Menu)this.Master.FindControl("MainMenu");
>
>
>
> Then I could access the MenuItems normally. Help!
>
>
>
>
>
> The FormView is inside a wizard.
>
>
>
>
>
>