<button type="submit" id="btn" name="Command" value="Cancel" onclick="location.href='<%: Url.Action("Capture", "TTSCreate") %>'" />
<script>
$("[id*=btn]").click(function (e) {
alert('This is a custom alert box', 'Alert Dialog');
});
</script>
[HttpPost]
public ActionResult Capture(PrtScreen prt, string command)
{
if (command == "Cancel")
{
int FileCount = 0;
//int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
//int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(1920, 1080);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(1920, 1080));
bmpScreenShot.Save("d:\\example" + FileCount + ".jpg ", ImageFormat.Png);
}