ASP.net webpage troubleshooting required

  • Thread starter Thread starter DemiAngel
  • Start date Start date
  • Tags Tags
    Troubleshooting
AI Thread Summary
The discussion centers on issues encountered while developing a student marks evaluation webpage using C#. The main problems include a persistent "#line error" and difficulties with the if-else statements for grade evaluation. It's suggested to review the use of boolean operators, specifically the difference between "||" (or) and "&&" (and), and to consider eliminating unnecessary boolean logic. Additionally, there is a recommendation to check the syntax for "else if" statements to ensure proper functionality. The user seeks assistance in resolving these coding challenges.
DemiAngel
Messages
1
Reaction score
0
Hi, I'm working on a students marks evaluation webpage, unfortunatly i run into several problems and i need some help fixing it :smile:

Code:
<%@ Page Language="C#" %>
<script runat="server">

    void submit(object sender, System.EventArgs e)
    {
    lblMessage1.Text = TextBox1.Text;
    lblMessage2.Text = TextBox2.Text;
    lblMessage3.Text = DropListItem.SelectedItem.Text;
    }
    void Calculate(Object sender, System.EventArgs e)
    {
    int TotalGrade = Convert.ToInt32(TextBox3.Text) +
    Convert.ToInt32(TextBox4.Text) + Convert.ToInt32(TextBox5.Text);
    lblMessage4.Text = TotalGrade.ToString();
    }
    int Result
    {
    get { return Convert.ToInt32(lblMessage4.Text); }
     if (TotalGrade <= 100 || TotalGrade >= 90)
         lblMessage5.Text = "A, Excellent!";
     }
     else
     {
       if (TotalGrade <= 89 || TotalGrade >= 80)
         lblMessage5.Text = "B, Very Good!";
     }
     else
     {

        if (TotalGrade <= 79 || TotalGrade >= 70)
         lblMessage5.Text = "C, Good!";

     else
     {
        if (TotalGrade <= 69 || TotalGrade >= 60)
         lblMessage5.Text = "D, Not Bad!";

     else
     {
        if (TotalGrade <= 59 || TotalGrade >= 50)
         lblMessage5.Text = "E, Work Harder!";

     else
     {
        if (TotalGrade <= 49)
         lblMessage5.Text = "F, You Failed!";

</script>
<html>
<head>
    <title></title>
</head>
<body dir="ltr">
    <form runat="server">
        <p align="center">
        </p>
        <p align="center">
            <strong><font size="5"><u></u></font></strong>
        </p>
        <p align="center">
            <strong><font size="5"><u></u></font></strong>
        </p>
        <p align="center">
            <strong><font size="5"><u></u></font></strong>
        </p>
        <p align="center">
            <strong><font size="5"><u></u></font></strong>
        </p>
        <p align="center">
            <strong><font size="5"><u></u></font></strong>
        </p>
        <p align="center">
            <strong><font size="5"><u></u></font></strong>
        </p>
        <p align="center">
            <strong><font size="5"><u></u></font></strong>
        </p>
        <p align="center">
            <strong><font size="5"><u></u></font></strong>
        </p>
        <p align="center">
            <strong><font size="5"><u></u></font></strong>
        </p>
        <p align="center">
            <strong><font size="5"><u></u></font></strong>
        </p>
        <p align="center">
            <strong><font size="5"><u>Personal Information Form</u></font></strong>
        </p>
        <p align="center">
            <strong>Enter the Student Name :</strong>
        </p>
        <p align="center">
            <em><u>Student Name</u>:&nbsp;
            <asp:TextBox id="TextBox18" runat="server" Width="179px"></asp:TextBox>
            </em>
        </p>
        <p align="center">
            <strong>Enter the Student ID number :</strong>
        </p>
        <p align="center">
            <em><u>Student ID</u>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:TextBox id="TextBox19" runat="server" Width="179px"></asp:TextBox>
            </em>
        </p>
        <p align="center">
            <strong>Select Subject Code From the List:</strong>
        </p>
        <p align="center">
        </p>
        <p align="center">
            <asp:DropDownList id="DropDownList4" runat="server">
                <asp:ListItem>CIS 101</asp:ListItem>
                <asp:ListItem>CIS 102</asp:ListItem>
                <asp:ListItem>CIS 103</asp:ListItem>
                <asp:ListItem>CIS 110</asp:ListItem>
            </asp:DropDownList>
        </p>
        <p align="center">
            _________________________________
        </p>
        <p align="center">
            <font size="5"><strong><u>Student Grade Evaluation Form</u></strong></font>
        </p>
        <p align="center">
            <strong>Enter the Student Grades:</strong>&nbsp;
        </p>
        <p align="center">
            <em>First Grade:</em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:TextBox id="TextBox15" runat="server" Width="180px"></asp:TextBox>
        </p>
        <p align="center">
            <em>Second Grade:&nbsp;
            <asp:TextBox id="TextBox16" runat="server" Width="180px"></asp:TextBox>
            </em>
        </p>
        <p align="center">
            <em>Final Grade:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:TextBox id="TextBox17" runat="server" Width="180px"></asp:TextBox>
            </em>
        </p>
        <p align="center">
            <em>============================= </em>
        </p>
        <em></em><em>
        <p align="center">
            <asp:Button id="Button2" onclick="submit" runat="server" Width="287px" Text="Get Student Information Now"></asp:Button>
        </p>
        <p align="center">
            <asp:Button id="Button3" onclick="Calculate" runat="server" Width="286px" Text="Get the Total Grade Now"></asp:Button>
        </p>
        </em><em>
        <p align="center">
            Student Name: <asp:Label id="lblMessage1" runat="server"></asp:Label>
        </p>
        <p align="center">
            Student ID: <asp:Label id="lblMessage2" runat="server"></asp:Label>
        </p>
        <p align="center">
            Student Selected Subject: <asp:Label id="lblMessage3" runat="server"></asp:Label>
        </p>
        </em>
        <p align="center">
            <em>Total Grade: </em><asp:Label id="lblMessage4" runat="server" font-italic="True"></asp:Label><em></em>
        </p>
        <p align="center">
            <em></em>
        </p>
        <p align="center">
            <em>&nbsp;Evaluation Letter:&nbsp;</em><asp:Label id="lblMessage5" runat="server" font-italic="True"></asp:Label><em></em>
        </p>
    </form>
</body>
</html>

Mainly i can't fix the #line error that i always get and i can't make the if-else statements to work :mad:

Please help me out & thanks,
 
Technology news on Phys.org
Since this looks like homework I would suggest you look up the difference between the boolean operators || and &&.

You might also think about how you can eliminate the need for the boolean operator altogether.

Last but not least you might want to check the syntax on "else if"
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
3
Views
2K
Back
Top