Header Ads Widget

ASP.NET Practical-4 &5

_ASP.NET

PRACTICAL-4&5



AIM: Design a web form to allow user to enter following details in his Resume using Web Server Controls. Set validations using properties. When data is submitted it must be viewed in the panel below the form. Fields of Resume are First Name, Surname, Gender, Address, City, Pin code, Phone, Qualification (Diploma, Bachelor, Master), Specialization subject, Percentage.


Code aspx:-

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="form1.aspx.vb" Inherits="Sem5pract04.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Project 04 </title>
    </head>
<body>
    <form id="form1" runat="server">
        <div>
            <table>
                <tr>
                    <td>First Name:-</td>
                    <td>
                        <asp:TextBox ID="textbfirstn" required="required" MaxLength="17" runat="server" />
                    </td>
                    
                </tr>
                <tr>
                    <td>Surname:-</td>
                    <td>
                        <asp:TextBox ID="textbSurname" MaxLength="17" runat="server" />
                    </td>
                    
                </tr>
                <tr>
                    <td>Gender:-</td>
                    <td>
                        <asp:RadioButton ID="radiobmale" GroupName="Gender" runat="server" Text="Male"/>
                        <asp:RadioButton ID="radiobfemale" GroupName="Gender" runat="server" Text="Female"/>
                        <asp:RadioButton ID="radiobtrans" GroupName="Gender" runat="server" Text="Transgender"/>
                    </td>
                </tr>
                <tr>
                    <td>Address:-</td>
                    <td>
                        <asp:TextBox ID="textbaddress" MaxLength="70" runat="server" TextMode="MultiLine" />
                    </td>
                    
                </tr>
                <tr>
                    <td>City:-</td>
                    <td>
                        <asp:DropDownList ID="dropcity" runat="server">
                            <asp:ListItem>Gandhinagar</asp:ListItem>
                            <asp:ListItem>Ahmedabad</asp:ListItem>
                            <asp:ListItem>Mehsana</asp:ListItem>
                            <asp:ListItem>Surat</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    
                </tr>
                <tr>
                    <td>Pincode:-</td>
                    <td>
                        <asp:TextBox ID="textbpicode" MaxLength="6" MinLength="6" runat="server" TextMode="Number" />
                    </td>
                    
                </tr>
                <tr>
                    <td>Phone:-</td>
                    <td>
                        <asp:TextBox ID="Textbphone" MaxLength="11" MinLength="10" runat="server" TextMode="Phone"/>
                    </td>
                   
                </tr>
                <tr>
                    <td>Qualification:-</td>
                    <td>
                        <asp:RadioButton ID="Radiobqualidip" GroupName="Qua" 
                        Text="Diploma" runat="server" />
                        <asp:RadioButton ID="Radiobqualibach" GroupName="Qua" 
                        Text="Bachelor" runat="server" />
                        <asp:RadioButton ID="Radiobqualimas" GroupName="Qua" 
                        Text="Master" runat="server" />
                    </td>
                   
                </tr>
                <tr>
                    <td>Specializtion Subject:-</td>
                    <td>
                        <asp:TextBox ID="TextbSpeciSub" MaxLength="20"
                         runat="server" />
                    </td>
                   
                </tr>
                <tr>
                    <td>Percentage</td>
                    <td>
                        <asp:TextBox ID="Textbpercentage" MaxLength="5" 
                        runat="server" />
                    </td>
                   
                </tr>
                <tr>
                    <td>

                    </td>
                    <td>
                        <asp:Button ID="btnSub" runat="server" Text="Submit" />
                    </td>
                </tr>
            </table>
            

            
        </div>
        <asp:Panel ID="Panel1" runat="server" Visible="false">
            <table>
                <tr>
                    <td>First Name:-</td>
                    <td>
                        <asp:Label ID="Labelfn" runat="server" />
                    </td>
                    
                </tr>
                <tr>
                    <td>Surname:-</td>
                    <td>
                        <asp:Label ID="LabelSurname" runat="server" />
                    </td>
                    
                </tr>
                <tr>
                    <td>Gender:-</td>
                    <td>
                        <asp:Label ID="LabelGender" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td>Address:-</td>
                    <td>
                        <asp:Label ID="LabelAddress" runat="server" />
                    </td>
                    
                </tr>
                <tr>
                    <td>City:-</td>
                    <td>
                        <asp:Label ID="LabelCity" runat="server" />
                    </td>
                    
                </tr>
                <tr>
                    <td>Pincode:-</td>
                    <td>
                        <asp:Label ID="LabelPincode" runat="server" />
                    </td>
                    
                </tr>
                <tr>
                    <td>Phone:-</td>
                    <td>
                        <asp:Label ID="LabelPhone" runat="server" />
                    </td>
                   
                </tr>
                <tr>
                    <td>Qualification:-</td>
                    <td>
                        <asp:Label ID="LabelQualification" runat="server" />
                    </td>
                   
                </tr>
                <tr>
                    <td>Specializtion Subject:-</td>
                    <td>
                        <asp:Label ID="LabelSpecSub" runat="server" />
                    </td>
                   
                </tr>
                <tr>
                    <td>Percentage</td>
                    <td>
                        <asp:Label ID="LabelPercentage" runat="server" />
                    </td>
                   
                </tr>
            </table>
        </asp:Panel>
    </form>
</body>
</html>







Code aspx.vb:-

Public Class WebForm1
    Inherits System.Web.UI.Page
    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnSub_Click(sender As Object, e As EventArgs) Handles btnSub.Click
        Panel1.Visible = True
        Labelfn.Text = textbfirstn.Text
        LabelSurname.Text = textbSurname.Text
        If radiobmale.Checked = True Then
            LabelGender.Text = "Male"
        Else
            LabelGender.Text = "Female"
        End If
        LabelAddress.Text = textbaddress.Text
        LabelCity.Text = dropcity.Text
        LabelPincode.Text = textbpicode.Text
        LabelPhone.Text = Textbphone.Text
        If Radiobqualidip.Checked = True Then
            LabelQualification.Text = "Diploma"
        ElseIf Radiobqualibach.Checked = True Then
            LabelQualification.Text = "Bachelor"
        Else
            LabelQualification.Text = "Master"
        End If
        LabelSpecSub.Text = TextbSpeciSub.Text
        LabelPercentage.Text = Textbpercentage.Text
    End Sub
End Class





Output:-


Figure 1:










PRACTICALS 05 

Create a web form where user enters following marks. 

ASP.NET, JAVA, ISS, Project (All out of 100). When user submits the marks, numeric value validation must be done. On entering marks, the grade should be displayed in message box . 

% > 90 and <<=100 AA 
> 80 and <<=90 AB 
> 70 and <<=80 BB 
> 60 and <<=67 BC 
>50 and <<=60 CC 
>40 and <= 50 DD 
Else Fail 
AIM:











Code.aspx: -

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" 
    Inherits="Sem5Pract05.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Practical 05</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>

            <table style="width:100%;">
                <tr>
                    <td>ASP.Net</td>
                    <td>
                        <asp:TextBox ID="Textbaspnet" runat="server"/>
                    </td>
                    <td>
                        <asp:Label ID="Labelapsnet" runat="server"/>
                    </td>
                </tr>
                <tr>
                    <td>Java</td>
                    <td>
                        <asp:TextBox ID="Textbjava" runat="server"/>
                    </td>
                    <td>
                        <asp:Label ID="Labeljava" runat="server"/>
                    </td>
                </tr>
                <tr>
                    <td>ICN</td>
                    <td>
                        <asp:TextBox ID="TextbICN" runat="server"/>
                    </td>
                    <td>
                        <asp:Label ID="LabelICN" runat="server"/>
                    </td>
                </tr>
                <tr>
                    <td>ENS</td>
                    <td>
                        <asp:TextBox ID="TextbENS" runat="server"/>
                    </td>
                    <td>
                        <asp:Label ID="LabelENS" runat="server"/>
                    </td>
                </tr>
                <tr>
                    <td>Project</td>
                    <td>
                        <asp:TextBox ID="Textbproject" runat="server"/>
                    </td>
                    <td>
                        <asp:Label ID="LabelProject" runat="server"/>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <asp:Button ID="Button" runat="server" Text="Grades" 
                        style="height: 29px" />
                    </td>
                    <td></td>
                </tr>

            </table>

        </div>
    </form>
</body>
</html>


Code aspx.vb: -

Public Class WebForm1
    Inherits System.Web.UI.Page
    Protected Sub Button_Click(sender As Object, e As EventArgs) Handles Button.Click
        Labelapsnet.Text = callinggrade(Textbaspnet.Text)
        Labeljava.Text = callinggrade(Textbjava.Text)
        LabelICN.Text = callinggrade(TextbICN.Text)
        LabelENS.Text = callinggrade(TextbENS.Text)
        LabelProject.Text = callinggrade(Textbproject.Text)
    End Sub
    Private Function callinggrade(ByVal txt As String) As String
        Dim grade As String
        If txt > 90 And txt <= 100 Then
            grade = "AA"
        ElseIf txt > 80 And txt <= 90 Then
            grade = "AB"
        ElseIf txt > 70 And txt <= 80 Then
            grade = "BB"
        ElseIf txt > 60 And txt <= 70 Then
            grade = "BC"
        ElseIf txt > 50 And txt <= 100 Then
            grade = "CC"
        ElseIf txt > 40 And txt <= 50 Then
            grade = "DD"
        Else
            grade = "Fail"
        End If
        Return grade
    End Function

End Class

Output:-

Figure : 1





Figure :2






Post a Comment

0 Comments