assaultkitty
asked on
C#2
Dear sirs: I am in need of some help here. I have created the html for this Employee Salary calculator. I know that I have to create an paycheck.html and a Default.aspx. I want the submit button to calculate the input for the hours and pay rate. Can someone help me? I am new to this ASP.NET and Visual Basic. I am trying to do this on my own just need a little guidance.
<!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>
<title>Paycheck</title>
<script language="C#" type="text/css">
function Text1_onclick() {
}
function Text2_onclick() {
}
void Submit1_onclick(object sender, EventArgs e) {
if (Text1.Text.Length < 1)
MessageBox.Show("Please Enter a value in Hours Field ");
else if (Text2.Text.Length < 1)
MessageBox.Show("Please Enter a value in Pay Rate Field");
else if (
else if
{
double hours = Convert.ToDouble(textBox1. Text);
double rate = Convert.ToDouble(textBox2. Text);
MessageBox.Show("Your Gross Pay is $" + ("hours - 40 * rate * 1.5");
}
</script>
</head>
<body>
<form action="Default.aspx" method="post">
<p>Enter Hours Worked:<input id="Text1" type="text" onclick="return Text1_onclick()" /></p>
<p>Enter Pay Rate:<input id="Text2" type="text" onclick="return Text2_onclick()" /></p>
<p><input id="Submit1" type="submit" value="submit" onclick="return Submit1_onclick()" /></p>
</form>
</body>
</html>
<!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>
<title>Paycheck</title>
<script language="C#" type="text/css">
function Text1_onclick() {
}
function Text2_onclick() {
}
void Submit1_onclick(object sender, EventArgs e) {
if (Text1.Text.Length < 1)
MessageBox.Show("Please Enter a value in Hours Field ");
else if (Text2.Text.Length < 1)
MessageBox.Show("Please Enter a value in Pay Rate Field");
else if (
else if
{
double hours = Convert.ToDouble(textBox1.
double rate = Convert.ToDouble(textBox2.
MessageBox.Show("Your Gross Pay is $" + ("hours - 40 * rate * 1.5");
}
</script>
</head>
<body>
<form action="Default.aspx" method="post">
<p>Enter Hours Worked:<input id="Text1" type="text" onclick="return Text1_onclick()" /></p>
<p>Enter Pay Rate:<input id="Text2" type="text" onclick="return Text2_onclick()" /></p>
<p><input id="Submit1" type="submit" value="submit" onclick="return Submit1_onclick()" /></p>
</form>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you say "I am new to this ASP.NET and Visual Basic", but the code is written in C#.
what will happen if the user enters a letter in either text box?
the result message box
MessageBox.Show("Your Gross Pay is $" + ("hours - 40 * rate * 1.5");
should show:
MessageBox.Show("Your Gross Pay is $" + hours - 40 * rate * 1.5;
or better:
MessageBox.Show(string.For
AW