[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MVC 4

Posted on 2014-08-23
2
Medium Priority
?
618 Views
Last Modified: 2014-08-25
Hi guys ,

I'm in a middle of webapp implementation one of my pages is providing for users to fill up quote, in this page I wrote some  javascript function in order to calculate the full quote and the sub total.

The issue is that the javascript code is not really functioning.

Here is my part of my code and I attached also some page view of my application.

 <tr>
                        <th valign="top">Dim's: </th>
                        <td>
                            @Html.TextBoxFor(m => m.Dims, new { @class = "inp-form-add ", @maxlength = 200 })
                        </td>
                        <th valign="top">Area: </th>
                        <td>
                            @Html.TextBoxFor(m => m.Area, new { @class = "inp-form-add", @maxlength = 200 })
                        </td>
                        <th valign="top">Discount Unit: </th>
                        <td>
                            @Html.TextBoxFor(m => m.DiscUnit, new { @class = "inp-form-add", @maxlength = 200 })
                        </td>


                    </tr>
                    <tr>

                        <th valign="top">Disc%: </th>
                        <td>
                            @Html.TextBoxFor(m => m.DiscP, new { @class = "inp-form-add",@onkeyup = "Calsum", @maxlength = 200 })
                        </td>

                        <th valign="top">Price-unit:</th>

                        <td>
                            @Html.TextBoxFor(m => m.Price, new { @class = "inp-form-add", @onkeypress = "return isNumberKey(event)", @onkeyup = "checkDec(this)", @maxlength = 12 })
                        </td>
                        <th valign="top">Total-Price: </th>
                        <td>
                            @Html.TextBoxFor(m => m.Total_Price, new { @class = "inp-form-add",@onchange = "Calsum", @maxlength = 200 })
                        </td>

Open in new window


 
<script type="text/javascript">
 function Calsum() {
            var untd = $('#DiscUnit').val();
            var pric = $('#Price').val();
            $('#Total_Price').val(untd * pric);
        }

</script>

Open in new window

Thanks ,
Capture.PNG
0
Comment
Question by:Moti Mashiah
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 total points
ID: 40281075
Change the attribute to:

@onkeyup = "Calsum();"

Open in new window


You need to actually execute the function, not point to it.
0
 
LVL 1

Author Closing Comment

by:Moti Mashiah
ID: 40283027
Thank you very much excellent solution.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month19 days, 14 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question