when autopostback is false RadNumeric textbox Textchange event does not occour

5 posts, 0 answers
  1. Kishor
    Kishor avatar
    82 posts
    Member since:
    Oct 2012

    Posted 17 Jun 2013 Link to this post

    Hello sir/mam

      I have radnumeric textboxes with autopostback false on a page .
      i want to assign total of two textboxes to third textbox , but the textchange event does not fires.

      it fires when autopostback of textbox is set to true and the page gets refresh each time i type in textbox and it also take some time because pageload gets call

     please help me to solve this problem.
      
      
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Jun 2013 Link to this post

    Hi,

    TextChanged event will fire only when the AutoPostBack property is set to true. So to avoid post-back on TextChanged event, try to do this in client side, you can either use "OnValueChanged" or "OnBlur".

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kishor
    Kishor avatar
    82 posts
    Member since:
    Oct 2012

    Posted 20 Jun 2013 Link to this post

     



    hello
     
    this is my code
    it works fine but it takes time for textchange event to occur
     
    I want to assign   txtprice * txtquantity to  txttotal
    but due to autopostback is true it takes time and total is assign after 5 to 7 seconds
     
    how can i solve his problem
     
    waiting for reply
     
     
     
    <asp:UpdatePanel ID ="up" runat ="server" >
          <ContentTemplate >
     
     
             <telerik:RadNumericTextBox ID="txtprice" AutoPostBack ="true"  runat="server"  MaxLength ="10" Width ="120px">
                         <NumberFormat AllowRounding ="false" DecimalDigits = "2" DecimalSeparator ="."
                         GroupSeparator ="," KeepTrailingZerosOnFocus ="true"  />
              </telerik:RadNumericTextBox>
     
     
             <telerik:RadNumericTextBox ID="txtquantity" AutoPostBack ="true"  runat="server"  MaxLength ="10" Width ="120px">
                         <NumberFormat AllowRounding ="false" DecimalDigits = "2" DecimalSeparator ="."
                         GroupSeparator ="," KeepTrailingZerosOnFocus ="true"  />
              </telerik:RadNumericTextBox>
     
     
               <telerik:RadNumericTextBox ID="txtTotal" AutoPostBack ="true"  runat="server"  MaxLength ="10" Width ="120px">
                         <NumberFormat AllowRounding ="false" DecimalDigits = "2" DecimalSeparator ="."
                         GroupSeparator ="," KeepTrailingZerosOnFocus ="true"  />
                 </telerik:RadNumericTextBox>
     
     </ContentTemplate>
                  
          </asp:UpdatePanel>
     
        VB CODE
     
     
         Protected Sub txtprice_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles  txtprice.TextChanged
              
              txtTotal.Text = (Convert.ToDouble(txtquantity.Text) * Convert.ToDouble(txtprice.Text))
     
           
         End Sub
      


            
       
  5. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 25 Jun 2013 Link to this post

    Hi Sawan,

    In this case, you do not need to make a postback to the server. You can easily achieve your requirement by implementing a client side approach:
    <telerik:RadNumericTextBox ID="txtprice"...>
        <ClientEvents OnValueChanged="valueChanged" />
    </telerik:RadNumericTextBox>
    <telerik:RadNumericTextBox ID="txtquantity" ...>
        <ClientEvents OnValueChanged="valueChanged" />
    </telerik:RadNumericTextBox>
    JavaScript:
    function valueChanged(sender, args) {
        var price = $find("<%= txtprice.ClientID %>").get_value();
        var quantity = $find("<%= txtquantity.ClientID %>").get_value();
     
        $find("<%= txtTotal.ClientID %>").set_value(price * quantity);
    }

    Hope this helps. Please give it a try and let me know if it works for you.

    Regards,
    Eyup
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  6. Kishor
    Kishor avatar
    82 posts
    Member since:
    Oct 2012

    Posted 25 Jun 2013 Link to this post

    thanks a lot its working fine
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017