0

i'am new in ASP.net MVC

I want to upper a popup box when i click on an Html button , and when i confirm this Alert i want to be redirected to a specificed Action in my controller.

Any ideas please.

tereško
  • 58,060
  • 25
  • 98
  • 150
Abel
  • 3
  • 3
  • Hi, Welcome to SO. Your question is overly broad for this site. You should read the [help] – Liam Apr 11 '14 at 14:34
  • Do you want a nice pretty dialog, with custom HTML and CSS or do you want to capture the result of a javascript `alert("message")` – Nate Apr 11 '14 at 14:53
  • yes Nate, that's exactly what i want – Abel Apr 24 '14 at 13:48

1 Answers1

0

use jQuery, you'll need to understand Dialog and javascript callback methods.

Example of a user giving a text response: http://www.jquery4u.com/snippets/jquery-alert-box/

Example of a dialog box with Yes and No buttons: Yes or No confirm box using jQuery

To invoke an action on a controller you could do this, javascript:

window.location.href = "/ControllerName/DoIt?id=12345&msg=hello";

or

$.ajax( {url:"/ControllerName/DoIt",
        data: "id=12345&msg=hello",
        success: function (data){
        }
});

Your controller method would look like this:

public ActionResult DoIt(int id, string msg )
{
   .....
}
Community
  • 1
  • 1
T McKeown
  • 12,971
  • 1
  • 25
  • 32
  • yes i totaly agree with you, but my problem is how to send an Action from the popup to the Controller (if i click on yes for exemple ) – Abel Apr 11 '14 at 14:45