hot to update of RadTextBox value using jquery

3 posts, 1 answers
  1. Lina
    Lina avatar
    31 posts
    Member since:
    May 2013

    Posted 21 Mar 2014 Link to this post

    hi

    what is the correct way to update the RadTextBox value in jquery?
    when one field is updated, i need to update another RadTextBox.
    the code bellow seems to update the text box but when i click inside the text box the field becomes empty, and when submitting it it's empty as well.
    what am doing wrong?

       <telerik:RadTextBox ID="txtName" runat="server" Height="24px" ClientEvents-OnBlur="txtName_Blur">
       </telerik:RadTextBox>
       <telerik:RadTextBox ID="txtProductSiteNumber" runat="server" Height="24px">
       </telerik:RadTextBox>

            function txtName_Blur(sender, eventArgs)
            {
                    var productName = sender.get_value();
                    var txtProductSiteNumber = "";
                    var txtProductSiteNumber = $telerik.$("#ctl00_ContentPlaceHolder1_txtProductSiteNumber").val();

                     $telerik.$("#ctl00_ContentPlaceHolder1_txtProductSiteNumber").val(productName);
                     $telerik.$("#ctl00_ContentPlaceHolder1_txtProductSiteNumber_text").val(productName);
            }

    10x
    lina
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Mar 2014 in reply to Lina Link to this post

    Hi Lina,

    Please try the following code snippet to set the TextBox text.

    JS:
    function txtName_Blur(sender, eventArgs) {       
       var txtProductSiteNumber = $find("<%=txtProductSiteNumber.ClientID %>");
       var name = sender._value; //Get the TextBox value
       txtProductSiteNumber.set_value(name); //Set the next TextBox value
    }

    Thanks,
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lina
    Lina avatar
    31 posts
    Member since:
    May 2013

    Posted 24 Mar 2014 in reply to Princy Link to this post

    thanks Princy. it's working
Back to Top