Q:

How to Write Confirm dialogue Box Code in Controller? For Asp.net MVC

Here Is My Sample Code- Its About Calculation Like Bank WithDraw Method.. If User Withdraw is Negative value then Show a Dialogue Box (yes/No) option ...
[HttpPost]
public ActionResult withdraw()
{
   if(Sum<0)
       {
          Code For Dialogue Box;
              if(Yes)
                 //Do
               else
                 //Exists
       }

    return View();
}

A:

@Euphoria's answer is one way to achieve your goal. But why should I call to server when I can check the withdraw value and show an alert message in my client side itself.
I would suggest to call a jquery/js function on button click or whatever, like bellow,
$('#withdrawBtn').click(function(){
//Take the withdraw fields value. Let's say it's a text box with ID myWithdrawTextBox
if($('#myWithdrawTextBox').val() > 0)
 {
   //Post to your server. I mean call your Action Method
 }
else
  alert('Please enter correct amount');
})

Hope it helps :)

