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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:





129406 Mar 16,2017 06:38 AM UTC Mar 20,2017 05:21 AM UTC ASP.NET MVC 3
Tags: Grid
Andrias Abadi
Asked On March 16, 2017 06:38 AM UTC

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

Venkatesh Ayothi Raman [Syncfusion]
Replied On 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. 

Andrias Abadi
Replied On March 18, 2017 03:50 AM UTC

Thanks, that solves the problem!

Venkatesh Ayothi Raman [Syncfusion]
Replied On 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. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon