Create an application that obtains four int values from the user and displays the product. Design
Working with basic C# and ASP .NET
a) Create an application that obtains four int values from the user and displays the product. Design
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs"
Inherits="Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:TextBox ID="TextBox1" runat="server" Height="23px"></asp:TextBox>
<p>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</p>
<p>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</p>
<p>
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</p>
<p>
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
</p>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Button" />
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq; using
System.Web; using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int x, y, z, p;
x = Convert.ToInt16(TextBox1.Text);
y = Convert.ToInt16(TextBox2.Text); z
= Convert.ToInt16(TextBox3.Text); p =
Convert.ToInt16(TextBox4.Text); int q
= x * y * z * p;
TextBox5.Text = Convert.ToString(q);
}
}
Output
Comments
Post a Comment