Radgrid unable to set focus to a textbox in editmode in clientside using javascript

4 posts, 0 answers
  1. Pabanas
    Pabanas  avatar
    14 posts
    Member since:
    Nov 2008

    Posted 10 May 2009 Link to this post

    Hai ,

              I have Radgrid with 4 columns all are Radnumberictextboxes with onload , onfocus and onblur event handler in it . I tried to retain focus on the second textbox  in onblur event of the radnumeric text box becasue of invalid input by user using the following code .

    <script type="text/javascript" language="javascript" >

    Function Blur(sender, args) {

          var input_value = sender.GetValue() ;

            if  ( input_value    any condition   ) {
            
               var senderid = sender.get_id();
                document.getElementById(senderid).focus();
              }
                     
            }

    </script>

      I get the following error when I debug in IE .

    htmlfile: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.

      How do i retain focus using clientside script ?

      Thank you .













  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3748 posts

    Posted 13 May 2009 Link to this post

    Hello Pabanas ,

    I will suggest you to use the client-side API of the RadNumericTextBox control. Here is a code snippet showing how to achieve this:
    ... 
    $find(senderid).focus(); 
    ... 

    Kind regards,
    Georgi Krustev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Michael
    Michael avatar
    1 posts
    Member since:
    Oct 2010

    Posted 02 Nov 2011 Link to this post

    Hi,

    I am getting the same error:

    function RadComboBox1_ClientSelectedIndexChanged(sender, args) {
                var selectedRadGridEditRow = args.get_item();
                var textBox1 = $get(sender.get_id().replace("RadComboBox1", "TextBox1"));
                textBox1.value = selectedRadGridEditRow.get_attributes().getAttribute("JobTitle");
                textBox1.focus();
            }

    textBox1
    .value
     call works just fine, the value gets set. But when I call the textBox1.focus(), I get the htmlfile: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus error message.

    How do I resolve that?
  4. yakesh
    yakesh avatar
    2 posts
    Member since:
    Oct 2017

    Posted 27 Oct 2017 Link to this post

    Hi friends,

    I have an rad numeric text box ,I tried to set focus on text box ,it doesn't work on edge browser.

    i used this code

    function FocusUnitcost(sender, args) {
        var input = sender.get_value();
               sender.focus();
            sender.selectAllText()
        }

    Regards,

    Yakesh babu D

     

Back to Top