- Home
- Forum
- ASP.NET Web Forms
- LostFocus event in custom dialog with ejCurrencyTextbox
LostFocus event in custom dialog with ejCurrencyTextbox
Hello,
I'm trying to implement LostFocus event in custom dialog by using forcusout event in JS for ASP.Net web forms.
It is just a simple event adding numbers and set total number in total column.
If total column were not ejCurrencyTextbox, it works perfectly.
Sub A + Sub B value goes to Total column.
If total control were ejCurrencyTextbox, it doesn't work.
I've attached sample solution.
If row 229-233 were commented out, it works well, but I need to set control as ejCurrencyTextbox.
Could you please tell me where my code is wrong?
Regards,
Yukiko
Attachment: test_21853165.7z
SIGN IN To post a reply.
3 Replies
CI
Christopher Issac Sunder K
Syncfusion Team
November 28, 2018 11:40 AM UTC
Hi Yukiko,
Thank you for contacting Syncfusion support.
Our currency textbox have inbuilt support for focusOut event. Instead of using element’s focusout event, you can make use of the component’s focusOut event. Here is the modified code snippet,
|
$("#SubA").ejCurrencyTextbox({
decimalPlaces: 2,
showSpinButton: false,
watermarkText: "$0.00",
//Bind the focusOut event for CurrencyTextBox
focusOut: "calculateTotal"
});
$("#SubB").ejCurrencyTextbox({
decimalPlaces: 2,
showSpinButton: false,
watermarkText: "$0.00",
//Bind the focusOut event for CurrencyTextBox
focusOut: "calculateTotal"
});
$("#Total").ejCurrencyTextbox({
decimalPlaces: 2,
showSpinButton: false,
watermarkText: "$0.00"
});
//LostFocus event for both SubA and sub B currency textbox
function calculateTotal() {
// Instance for SubA CurrencyTextBox, it’s used to access the value to that textbox
var subAObj = $("#SubA").ejCurrencyTextbox("instance");
// Instance for SubB CurrencyTextBox, it’s used to access the value to that textbox
var subBObj = $("#SubB").ejCurrencyTextbox("instance");
// Instance for Total CurrencyTextBox, it’s used to access the value to that textbox
var totalObj = $("#Total").ejCurrencyTextbox("instance");
//Using instance to get the values and add it
var total = subBObj.model.value + subAObj.model.value;
//Update the total values to Total currency textbox
totalObj.option("value", total);
} |
To know more details about CurrencyTextBox component properties, methods and events, please check the below API document.
To know more details about Accessing Syncfusion components, please check the below help document.
Please let us know if you need any further assistance.
Thanks,
Christo
YI
Yukiko Imazu
November 28, 2018 07:14 PM UTC
Hi Christo,
Thank you for your support.
We could achieve our requirement.
Regards,
Yukiko
CI
Christopher Issac Sunder K
Syncfusion Team
November 29, 2018 06:03 AM UTC
Hi Yukiko,
We are glad to hear that the issue has been resolved at your end. Please let us know if you need any further assistance.
Thanks,
Christo
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
YI Yukiko Imazu
- Nov 27, 2018 03:59 PM UTC
- Nov 29, 2018 06:03 AM UTC