Page.Controls to identify server controls

Discussion in 'ASP .Net' started by KK, Jan 25, 2004.

  1. KK

    KK Guest

    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
    KK, Jan 25, 2004
    #1
    1. Advertising

  2. Why not explicitly show and hide the controls?

    "KK" <> wrote in message
    news:...
    > 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
    >
    >
    Peter Rilling, Jan 25, 2004
    #2
    1. Advertising

  3. KK

    Hermit Dave Guest

    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.

    --
    Regards,
    HD
    Once a Geek.... Always a Geek
    "KK" <> wrote in message
    news:...
    > 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
    >
    >
    Hermit Dave, Jan 25, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?YWdlaG0=?=
    Replies:
    0
    Views:
    325
    =?Utf-8?B?YWdlaG0=?=
    Sep 20, 2004
  2. Replies:
    2
    Views:
    463
    Richard Tobin
    Apr 11, 2008
  3. Replies:
    2
    Views:
    511
    darrel
    May 6, 2008
  4. David Elliott

    500 Server Error -- How do I identify the cause...

    David Elliott, Jan 26, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    122
    David Elliott
    Jan 26, 2005
  5. Andrew K
    Replies:
    1
    Views:
    122
    kaeli
    Feb 23, 2005
Loading...

Share This Page