0

I have formview and add logic to it when updating,inserting etc... However on each subroutine, I had to a a variable and a findcontrol in order to work with that control. Now, my code is bigger and harder to read.

My other approach was to put the 'fincontrols' outside the routines but I would get errors that it could not be found.

Is there a cleaner , better approach when working with controls on a formview?

causita
  • 1,607
  • 1
  • 20
  • 32
  • No, you have to use `FindControl` with the ID of the control and the correct (current) `FormViewMode` after it was databound. – Tim Schmelter Jul 25 '14 at 14:06

1 Answers1

0

This is how I use the find control function:

TextBox txt_test = (TextBox)FormView1.FindControl("txt_test");

as far as I know this is the easiest and cleanest way I could find.

Jack Ocean
  • 62
  • 11