This is a migrated thread and some comments may be shown as answers.

when autopostback is false RadNumeric textbox Textchange event does not occour

4 Answers 464 Views
Input
This is a migrated thread and some comments may be shown as answers.
Kishor
Top achievements
Rank 2
Kishor asked on 17 Jun 2013, 11:18 AM
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.
  
  

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Jun 2013, 12:38 PM
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.
0
Kishor
Top achievements
Rank 2
answered on 20 Jun 2013, 12:14 PM
 



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
  


        
   
0
Eyup
Telerik team
answered on 25 Jun 2013, 08:00 AM
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.
0
Kishor
Top achievements
Rank 2
answered on 25 Jun 2013, 11:46 AM
thanks a lot its working fine
Tags
Input
Asked by
Kishor
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Kishor
Top achievements
Rank 2
Eyup
Telerik team
Share this question
or