HTML Control: Input (C#) : TextBox « HTML Control « ASP.Net






HTML Control: Input (C#)

<%@ Page Language="C#" %>

<html>
<script runat=server>
protected void Page_Load(object src, EventArgs e)
{
  if (IsPostBack)
  {
    int op1 = int.Parse(_op.Value);
    int op2 = int.Parse(_sum.InnerText);
    _sum.InnerText = (op1+op2).ToString();
  }
}
</script>
<body>
  <form runat=server>
    <h2>ASP.NET accumulator page</h2>
    <input size=2 type=text id=_op runat=server/>
    Sum:<span id=_sum runat=server>0</span>
    <p>
     <input type=submit value="Add" />
    </p>
  </form>
</body>
</html> 

           
       








Related examples in the same category

1.Using an HTML Form Control: get value in input box and display (VB.net)