0

I am trying to make a number pad system to be used on touch screen devices where the user types in the numbers and the amount(partial view) is updated with the numbers entered.

After researching, it seems like the best method would be to use a [ChildActionOnly] action result in my controller so i have made this:

[ChildActionOnly]
 public ActionResult TopUpAmountPartial(int number, decimal currentAmount)
 {
      var Result = new TopUpViewModel
      {
           //ignore this bit
           Amount = currentAmount + 1
      };

            return PartialView(Result);
 }

I tried doing a "Html.ActionLink" as the number pad button which sort of worked but loaded the whole page as a new one which is not what i want at all.

I've also seen the idea of "Html.RenderAction" thrown around but i have no idea how to get that to work with a button click.

Am I on the right tracks or do I just sound crazy?

Ehsan Sajjad
  • 61,834
  • 16
  • 105
  • 160
rubidge96
  • 109
  • 2
  • 12
  • You need to use ajax if you want to update the current page (and you cannot call a `[ChildActionOnly]` method using ajax (that is only applicable when using `@Html.Action()`) –  Apr 17 '18 at 11:20
  • So I am crazy then. Thank you :) – rubidge96 Apr 17 '18 at 11:28

0 Answers0