Page.Controls to identify server controls

  • Thread starter Thread starter KK
  • Start date Start date
K

KK

Hi

I have a webform. To enter data, there are couple of text boxes,
check boxes, select boxes etc.. Data will get collected and saved.
When user want to see the data(not edit) I thouht of showing the
same form. at that point, all the edit boxes, check boxes, list boxes
etc.. will get hidden and labels in those places will get shown.

For this next to every editable control I have a label. The problem
now is, when I ask the form to show it in VIEW form it should
iterate though all the controls and hide the editable controls and
set the visibility of labels to true.

I am having a problem of doing that iterating through the
Page.Controls collection.

Is there a better way to do this? I am trying to avoid 2 forms(one to
edit and one to display because database logic is almost same)

Thanks
KK
 
or how about putting the labels and textboxes in two seperate panels...
and then toggle the visibility of panel based on whether its read or edit.
 
Back
Top