"Protect" or Disable Editing of A Webcontrol

Discussion in 'ASP .Net' started by Randy, Jan 19, 2006.

  1. Randy

    Randy Guest

    I hope somebody can make a hero out of me before tomorrow! Let's say I
    have a web page with a couple of textboxes, checkboxes, radio buttons,
    etc. User fills in some data, clicks submit, and off it goes. Tomorrow,
    someone else retrieves that page with the data. I want the second user
    to see what looks like the same page, with the data now filled in, but
    with the data fields locked so that they can't be edited. I remember
    the old VB 6 Windows Form controls enable property would enable
    editing. The enable property on a web control, however, has a whole
    'nuther use. I already have a control that allows me to identify the
    specific controls I want to lock (and later unlock under certain
    circumstances), but I have no clue how to actually do the locking.
    Can somebody offer a hint?
    Any thoughts would be greatly appreciated.
    Randy, Jan 19, 2006
    1. Advertisements

  2. myTextField.ReadOnly = true;

    Gabriel Magaña, Jan 19, 2006
    1. Advertisements

  3. Randy

    Randy Guest

    AFIK, there ain't no such method/Property. Wish there were. Or are you
    suggesting something else?
    Randy, Jan 19, 2006
  4. Randy

    Randy Guest

    Oops. OK, well there's such a thing for a TextBox but I need to do the
    same thing for checkboxes, radiobuttons, even dropdown lists and
    listboxes. I think I can create a style sheet property that makes the
    various controls LOOK like they aren't editable, but I need them to be
    actually protected, read only, what have you.
    Randy, Jan 19, 2006
  5. Randy

    Guest Guest

    Try setting "Readonly=True" for text boxes and "Enabled=False" for the other
    Guest, Jan 19, 2006
  6. It'd be a little ugly, but you can use javascript, or you can use a bitmap
    instead of, say, a true checkbox... I've seen it done both ways, and each
    has drawbacks...
    Gabriel Magaña, Jan 19, 2006
  7. Randy

    Randy Guest

    Do you remember the Strawman from the Wizard of Oz? That's what I feel
    like right now... "If I only had a brain."
    10 minutes ago, I would have swon by anything you like that the Enabled
    property had to do with whether a control's value was recorded in the
    ViewState array. I don't know where I get these crazy ideas.
    Thank you for setting me straight.
    Randy, Jan 19, 2006
  8. Randy

    Guest Guest

    My Pleasure.
    Guest, Jan 19, 2006
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.