Home All Groups Group Topic Archive Search About

Referencing controls inside FormView

Author
3 Jan 2007 12:04 PM
Barry
Hi

This question is related to ASP WebApplication , I have a FormView on the
Page and the FormView has Templates like InsertItemTemplate,
EditItemTemplate etc.  on the InsertItemTemplate i have a control named

FormView1.InsertItemTemplate.InsertTemplate.TextBoxLastName

what is the method of referencing the controls "TextBoxLastName" in code

TIA
Barry

Author
4 Jan 2007 1:59 PM
Milosz Skalecki [MCAD]
You cannot reference controls in templated container directly, use

TextBox textBox = (TextBox) formView.FindControl("TextBoxLastName");

hope this helps
--
Milosz


Show quote
"Barry" wrote:

> Hi
>
> This question is related to ASP WebApplication , I have a FormView on the
> Page and the FormView has Templates like InsertItemTemplate,
> EditItemTemplate etc.  on the InsertItemTemplate i have a control named
>
> FormView1.InsertItemTemplate.InsertTemplate.TextBoxLastName
>
> what is the method of referencing the controls "TextBoxLastName" in code
>
> TIA
> Barry
>
>
>

AddThis Social Bookmark Button