Text boxes and read-only text

Discussion in 'ASP .Net' started by Julie, May 12, 2004.

  1. Julie

    Julie Guest

    I'm wondering what standard/best practices are for the following scenario:

    I have a page representing several fields for stored data. If the user has
    sufficient access privileges, the page is rendered w/ read/write text boxes and
    they can edit the various fields as needed. However, if the user doesn't have
    sufficient privileges (i.e. view only), the page is rendered w/ the text boxes
    set to read-only. However, this results in a rather clunky looking page, and
    if there is more text in a box than can be rendered w/i the specified box
    height, then the user must scroll. Further, when printing the page, the text
    is clipped to the box.

    So, my thought has been to re-design the page to use two different controls for
    each text field: a text box for read/write, and a label (static text) for
    read-only. My thought that it will result in a much cleaner view page, and
    printing will be as expected. The negative is that there are then two controls
    for each field, and I must hide/show the appropriate control depending on the
    read-write/read-only status.

    Is there a better way to do this that doesn't rely on two controls for each
    control?

    Thanks for any thoughts and insights.
     
    Julie, May 12, 2004
    #1
    1. Advertising

  2. Julie

    Darren Clark Guest

    What is your browser base?

    If you know that it is IE only..

    check out contenteditable... basically it allows any html element to be
    editable..
    http://msdn.microsoft.com/library/d...html/reference/properties/contenteditable.asp

    so you could do
    <div contenteditable="true">This text it editable</div>
    for those that have read write..
    then simply change the flag to false if it is readonly,

    This means printing doesnt get cliped either.

    To make it so that you can still reference input ins your code you can do

    <div contenteditable="true" id="Body" onpropertychange="BodyInput.value =
    this.innerText;">This text it editable</div>
    <input type="hidden" name="BodyInput" value="">

    then you simple get the data from the this.BodyInput.value property on the
    server.

    Not sure if this is what you are after but it may give you ideas as to where
    to go from here.



    "Julie" <> wrote in message
    news:...
    > I'm wondering what standard/best practices are for the following scenario:
    >
    > I have a page representing several fields for stored data. If the user

    has
    > sufficient access privileges, the page is rendered w/ read/write text

    boxes and
    > they can edit the various fields as needed. However, if the user doesn't

    have
    > sufficient privileges (i.e. view only), the page is rendered w/ the text

    boxes
    > set to read-only. However, this results in a rather clunky looking page,

    and
    > if there is more text in a box than can be rendered w/i the specified box
    > height, then the user must scroll. Further, when printing the page, the

    text
    > is clipped to the box.
    >
    > So, my thought has been to re-design the page to use two different

    controls for
    > each text field: a text box for read/write, and a label (static text) for
    > read-only. My thought that it will result in a much cleaner view page,

    and
    > printing will be as expected. The negative is that there are then two

    controls
    > for each field, and I must hide/show the appropriate control depending on

    the
    > read-write/read-only status.
    >
    > Is there a better way to do this that doesn't rely on two controls for

    each
    > control?
    >
    > Thanks for any thoughts and insights.
     
    Darren Clark, May 12, 2004
    #2
    1. Advertising

  3. Julie

    Julie Guest

    Darren Clark wrote:
    >
    > What is your browser base?
    >
    > If you know that it is IE only..
    >
    > check out contenteditable... basically it allows any html element to be
    > editable..
    > http://msdn.microsoft.com/library/d...html/reference/properties/contenteditable.asp
    >
    > so you could do
    > <div contenteditable="true">This text it editable</div>
    > for those that have read write..
    > then simply change the flag to false if it is readonly,
    >
    > This means printing doesnt get cliped either.
    >
    > To make it so that you can still reference input ins your code you can do
    >
    > <div contenteditable="true" id="Body" onpropertychange="BodyInput.value =
    > this.innerText;">This text it editable</div>
    > <input type="hidden" name="BodyInput" value="">
    >
    > then you simple get the data from the this.BodyInput.value property on the
    > server.
    >
    > Not sure if this is what you are after but it may give you ideas as to where
    > to go from here.


    Thanks for the link and info, I'll look into it.

    And, yes, my target is IE.
     
    Julie, May 12, 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. Ravindra
    Replies:
    2
    Views:
    438
    Natty Gur
    Dec 19, 2003
  2. keithb
    Replies:
    2
    Views:
    8,024
    keithb
    Jun 7, 2006
  3. Stefan Mueller
    Replies:
    5
    Views:
    12,415
    jamesxa
    Jun 16, 2009
  4. A
    Replies:
    1
    Views:
    326
    Ian Collins
    Nov 3, 2010
  5. Replies:
    6
    Views:
    101
    Mick White
    May 12, 2005
Loading...

Share This Page