Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Source code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Marks.aspx.cs" Inherits="Marks"


%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style2 {
width: 149px;
font-weight: bold;
text-align: left;
}
.auto-style3 {
height: 26px;
text-align: left;
}
.auto-style5 {
height: 26px;
width: 149px;
text-align: left;
}
.newStyle1 {
font-family: Arial;
color: #6666FF;
}
.newStyle2 {
}
.auto-style6 {
font-weight: bold;
text-align: left;
}
.newStyle3 {
font-size: x-large;
}
.newStyle4 {
background-color: #82D094;
}
.newStyle5 {
background-color: #99F0BE;
}
.newStyle6 {
border: medium double #82D094;
}
.newStyle7 {
background-color: #99F0BE;
}
</style>
</head>
<body style="text-align: left">
<form id="form1" runat="server">
<div style="text-align: center">

<strong class="newStyle3">RESULT</strong></div>
<table align="center" class="newStyle7">
<tr>
<td class="auto-style2">SUBJECT</td>
<td class="auto-style6">MARKS</td>
</tr>
<tr>
<td class="auto-style5">ENS</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="0 to 100" MaximumValue="100" MinimumValue="0"
Type="Integer"></asp:RangeValidator>
</td>
</tr>
<tr>
<td class="auto-style5">ASP.Net</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator2" runat="server"
ControlToValidate="TextBox2" ErrorMessage="0 to 100" MaximumValue="100" MinimumValue="0"
Type="Integer"></asp:RangeValidator>
</td>
</tr>
<tr>
<td class="auto-style5">ICN</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator3" runat="server"
ControlToValidate="TextBox3" ErrorMessage="0 to 100" MaximumValue="100" MinimumValue="0"
Type="Integer"></asp:RangeValidator>
</td>
</tr>
<tr>
<td class="auto-style5">JAVA</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator4" runat="server"
ControlToValidate="TextBox4" ErrorMessage="0 to 100" MaximumValue="100" MinimumValue="0"
Type="Integer"></asp:RangeValidator>
</td>
</tr>
<tr>
<td class="auto-style5">PROJECT</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator5" runat="server"
ControlToValidate="TextBox5" ErrorMessage="0 to 100" MaximumValue="100" MinimumValue="0"
Type="Integer"></asp:RangeValidator>
</td>
</tr>
<tr>
<td class="auto-style5">&nbsp;</td>
<td class="auto-style3">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click1"
Text="Submit" />
</td>
</tr>
<tr>
<td class="auto-style3" colspan="2">&nbsp;<asp:Panel ID="Panel1"
runat="server">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>
</asp:Panel>
</td>
</tr>
</table>
</form>
</body>
</html>

Code behind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Marks : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
Panel1.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{

}
protected void Button1_Click1(object sender, EventArgs e)
{
Panel1.Visible = true;
int sum;
float per;
sum = Convert.ToInt32(TextBox1.Text) + Convert.ToInt32(TextBox2.Text) +
Convert.ToInt32(TextBox3.Text) + Convert.ToInt32(TextBox4.Text) +
Convert.ToInt32(TextBox5.Text);
per = sum / 5;
if (per <= 100 && per >= 90)
{
Label1.Text = sum.ToString();
Label2.Text = per.ToString();
Label3.Text = "AA Congratulations you passed!";

}
else if (per < 90 && per >= 80)
{
Label1.Text = sum.ToString();
Label2.Text = per.ToString();
Label3.Text = "AB Congratulations you passed!";
}
else if (per < 80 && per >= 70)
{
Label1.Text = sum.ToString();
Label2.Text = per.ToString();
Label3.Text = "BB Congratulations you passed!";
}
else if (per < 70 && per >= 60)
{
Label1.Text = sum.ToString();
Label2.Text = per.ToString();
Label3.Text = "BC Congratulations you passed!";
}
else if (per < 60 && per >= 50)
{
Label1.Text = sum.ToString();
Label2.Text = per.ToString();
Label3.Text = "CC Congratulations you passed!";
}
else if (per < 50 && per >= 40)
{
Label1.Text = sum.ToString();
Label2.Text = per.ToString();
Label3.Text = "CD You passed";
}
else if (per < 40 && per >= 30)
{
Label1.Text = sum.ToString();
Label2.Text = per.ToString();
Label3.Text = "DD You passed";
}
else if (per < 30 && per >= 20)
{
Label1.Text = sum.ToString();
Label2.Text = per.ToString();
Label3.Text = "FF Better Luck Next Time";
}

}
}

You might also like