Simulate in place editing

2 posts, 0 answers
  1. Paul
    Paul avatar
    34 posts
    Member since:
    Aug 2011

    Posted 16 Apr Link to this post

    Hi,
    I am using the Tree List control with Auto Generate Columns set to false. I want to use in place editing, but the documentation states that in place editing is only for Auto Generate Columns. I have placed an HTML text box in an item template with an onClick event.

    <input id="txtDescription" type="text" value="<%# Eval("Description") %>" onclick="Field_onClick(this, false);" onblur="Field_onBlur(this);" readonly="readonly" />

    function Field_onClick(txt, allowBlank) {
        if (_mode == mode.Params) {
            _tlConfig.AllowEdit = true;
            txt.readOnly = '';
            txt.focus();
        }
    }

    The problem is that I have to click on the text box twice before I can edit it contents. Is there a way around this problem?

     

    Thanks, Paul.

  2. Paul
    Paul avatar
    34 posts
    Member since:
    Aug 2011

    Posted 18 Apr in reply to Paul Link to this post

    I was able to solve the problem by selecting any existing text after setting focus:

    txt.select()

    or

    var txtLen = txt.length;
    txt.setSelectionRange(0, txtLen);

Back to Top