ReadOnly Field

4 posts, 0 answers
  1. Raymond
    Raymond avatar
    53 posts
    Member since:
    Aug 2007

    Posted 29 Aug 2008 Link to this post

    Is it possible to get the changed value of readonly numeric text box during javascript processing on postback?
  2. Plamen Peshev
    Admin
    Plamen Peshev avatar
    885 posts

    Posted 01 Sep 2008 Link to this post

    Hello Raymond,


    Please find attached a sample web application that demonstrates the needed approach.

    Kind regards,
    Plamen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Kennon McCaa
    Kennon McCaa avatar
    8 posts
    Member since:
    Jun 2009

    Posted 06 Oct 2009 Link to this post

    I am experiencing this issue too. Whenever my page attempts to save the new values the user has entered in the non-readonly controls the codebehind never sees the new values although the FindControl method does find the control.

    I tried what was suggested in the attachment (with some modification for my situation) but my JS code never executes "MADE IT 2". It does however say that it found the control and makes it to "MADE IT 1" but somehow errors out when executing this line:

    input.updateCssClass();


    Here's my full function:
     
    function TstUpdateCss(p_ctrlClientId) {   
       var input = $get(p_ctrlClientId);   
     if (input == null) {   
     alert("NOT FOUND");   
     } else {   
      alert("FOUND");   
     }  
     
     alert("MADE IT 1");   
     input.updateCssClass();  
     alert("MADE IT 2");   
     return;  

    In the example the following line was included:
        input._textBoxElement.readOnly = readOnly;

    Which I changed to: 
        input._textBoxElement.readOnly = false;

    But the line errored every time so I removed it.

    In the interest of full disclosure, in my case I am calling the TstUpdateCss() function from the onChange event of the control.

    Also, this problem only appears to happen when AJAX is running. Furhtermore, although my codebehind is executed my AJAX hourglass indicator that is displayed to the user spins endlessly.

    Also, the control in question is located within a grid control's EditFormSettings.

    I am using Telerik.Web.UI v 2009.2.701.35

    Thanks for any help.

     

  4. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 09 Oct 2009 Link to this post

    Hello Kennon,

    You should be executing $find() instead $get() when getting hand of the input client component. The $get() method returns the dom element of the control, while $find() gets the client component to which the updateCssClass() belongs. It is no wonder that the execution never reaches the second alert as before that you are trying to execute a method which does not exist in the input.

    I hope this information helps.

    Regards,
    Tsvetoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top