We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Update TotalPrice value in edit dialog based on other field's value

Hi, I'm using the mvc grid to create invoice tables but I need the edit dialog to show the total price by multiplying the qty and unitprice when the value changes.
I can get the totalprice value displayed just fine using jsrender template after confirming insert dialog but not while in the dialog. I read some posts saying about LiveUpdate but I cant seem to find this one

Attachment: Syncfusion_Help_78ed95c9.rar

3 Replies

VA Venkatesh Ayothi Raman Syncfusion Team March 17, 2017 11:15 AM UTC

Hi Andrias, 
Thanks for contacting Syncfusion support. 
We have achieved your requirement using Dialog template editing. In that, we have rendered the dialog template edit form with expression column (total field) value while we change the data quantity and price Numeric text box then we must change the expression column value like as follows, 
Code example
        . . . 
    .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.DialogTemplate).DialogEditorTemplateID("#template"); }) 
            .Columns(col => 
                col.HeaderText("total").Template("{{:quantity * Price}}").Width(85).Add();        
                .ClientSideEvents(e => e.ActionComplete("actionComplete")) 
@action complete 
  function actionComplete(args) { 
                //here we can bound the Numeric textbox control for qunatity and price column as well as define the change event for both 
                if ((args.requestType == "beginedit" || args.requestType == "add") && args.model.editSettings.editMode == "dialogtemplate") { 
                    $("#quantity").ejNumericTextbox({ value: $("#quantity").val(), change: "quantityChange" }); 
                    $("#Price").ejNumericTextbox({ value: $("#Price").val(), change: "PriceChange" }); 
@quanity change event 
            function quantityChange(args) { 
                var price = +($("#Price").val()); // get the current value from input field 
                var quantity = +(args.value); 
                var total = price * quantity; 
@price change event 
            function PriceChange(args) { 
                var price = +(args.value); // get the current value from input field 
                var quantity = +($("#quantity").val()); 
                var total = price * quantity; 


We have also prepared a sample for your convenience which can be download from following link. Please refer to the sample and Help documentation for your reference, 
Help documentation
Venkatesh Ayothiraman. 

AA Andrias Abadi March 18, 2017 03:50 AM UTC

Thanks, that solves the problem!

VA Venkatesh Ayothi Raman Syncfusion Team March 20, 2017 05:21 AM UTC

Hi Andrias, 
Thanks for the feedback. 
We are very happy to hear that your requirement is achieved. 
Venkatesh Ayothiraman. 

Live Chat Icon For mobile
Up arrow icon