2

I need something with similar functionality to the NumericUpDown tool of Windows Forms, and I've been informed that there is a javascript function of this nature. All the guides I can find from a google search seem to cover print functions and other features, that I'm not sure how to adapt.

How would I incorporate the javascript function into my web form and pass it's value reliably to the corresponding c# method?

Please forgive me if this is a silly question, I'm comparatively new to programming in general.

4
  • Depending on the browsers you target, there is an <input type=number> that's a built-in "up/down" input. Commented Jun 23, 2014 at 14:15
  • You can use some jquery plugin for numeric updown, and then use jquery ajax request to submit values to C# function. Commented Jun 23, 2014 at 14:16
  • 1
    @HansKesting this should work OK, I'm in a corporate environment where everyone has at least IE9. How would I implement this in a C# webform? Commented Jun 23, 2014 at 14:17
  • IE9 doesn't support it, IE10/11 don't show the up/down buttons. Apart from that, you could use <input type=number runat=server> Commented Jun 23, 2014 at 14:24

1 Answer 1

1

You can use Spinner plugin for JQuery.

From the client side using Jquery's Ajax method you can pass the variables to backend.

This question might help calling web methods via Ajax.

Sign up to request clarification or add additional context in comments.

2 Comments

How would I implement this in C#? is it a question of just placing it in the aspx page that I'm working in, and surrounding it with <script></script>?
From the client side you can get the values using javascript. Then pass these values to a web method that is written in C#. In short, it would be better to place client side scripts in ASPX page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.