Add-numbers-in-mvc

Unknown | 7:49 PM |

@{
    Layout = null;
}

 <!DOCTYPE html>
 <html lang="en">
 <head>
 <title>My Title</title>
 <meta charset="utf-8" />
 <style type="text/css">
     body
     {
         background-color: beige; font-family: Verdana, Arial;margin: 50px;
          }
          form
          {padding: 10px; border-style: solid; width: 250px;}
          </style>
          </head>
          <body>
          <p>
          Enter two whole numbers and then click
          <strong>Add</strong>.</p>
          <form action="" method="post">
          @{
            var total = 0;
            var totalMessage = "";
            if(IsPost)
             {
             @*Retrieve the numbers that the user entered.*@
             var num1 = Request["text1"];
             var num2 = Request["text2"];
             @*Convert the entered strings into integers numbers and add.*@
             total = num1.AsInt() + num2.AsInt();
             totalMessage = "Total = " + total;
             }
             }
          <p>
          <label for="text1">First Number:</label>
          <input type="text" name="text1" />
          </p><p>
          <label for="text2">Second Number:</label>
          <input type="text" name="text2" />
          </p><p>
          <input type="submit" value="Add" />
          </p>
          </form>
          <p>@totalMessage</p>
          </body>
          </html>

Category:

About http://dotnetvisual.blogspot.in/:
DOT NET TO ASP.NET is a web application framework marketed by Microsoft that programmers can use to build dynamic web sites, web applications and web services. It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime, allowing programmers to write ASP.NET code using any Microsoft .NET language. create an application very easily ....