0% found this document useful (0 votes)
29 views

Source Code

The document contains source code for an ASP.NET registration form with fields for user information like name, address, gender, hobbies, etc. and validations. It has HTML markup and CSS for layout and styling of the form elements. The code behind handles form submission and displays the submitted values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Source Code

The document contains source code for an ASP.NET registration form with fields for user information like name, address, gender, hobbies, etc. and validations. It has HTML markup and CSS for layout and styling of the form elements. The code behind handles form submission and displays the submitted values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Source Code:

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


%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">

.auto-style4 {
text-align: center;
}
.newStyle6 {
font-style: normal;
font-size: x-large;
}
.newStyle2 {
background-color: #3366CC;
}
.auto-style9 {
font-size: larger;
font-style: inherit;
font-weight: bold;
font-variant: normal;
color: #000040;
width: 205px;
}
.newStyle4 {
font-size: larger;
font-style: inherit;
font-weight: bold;
font-variant: normal;
color: #000040;
}
.auto-style5 {
width: 205px;
text-align: left;
}
.auto-style3 {
width: 355px;
margin-left: 40px;
}
.auto-style8 {
width: 355px;
margin-left: 40px;
text-align: left;
}
.auto-style6 {
width: 205px;
height: 26px;
text-align: left;
}
.auto-style7 {
width: 355px;
margin-left: 40px;
height: 26px;
text-align: left;
}
.auto-style2 { height: 54px;
text-align: left;
}
.auto-style10 {
width: 355px;
margin-left: 40px;
height: 26px;
}
.auto-style12 {
font-size: larger;
font-style: inherit;
font-weight: bold;
font-variant: normal;
color: #000040;
width: 355px;
}
.auto-style13 {
width: 205px;
text-align: left;
height: 24px;
}
.auto-style14 {
width: 355px;
margin-left: 40px;
height: 24px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<H3 class="auto-style4"><span class="newStyle6">Registration Form</span></H3>


<table class="newStyle2" align="center">
<tr>
<td class="auto-style9">First Name :</td>
<td class="auto-style12">
<asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox9" ErrorMessage="Enter your name"
ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style5">Middle Name :</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style5">Last Name :</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style5">Address : </td>
<td class="auto-style8">
<textarea id="TextArea1" cols="20" name="S1" rows="2"></textarea></td>
</tr>
<tr class="newStyle4">
<td class="auto-style5">Gender :</td>
<td class="auto-style3">
<asp:RadioButtonList ID="RadioButtonList1" runat="server" style="margin-
left: 0px" Width="306px">
<asp:ListItem>Male</asp:ListItem>
<asp:ListItem>Female</asp:ListItem>
<asp:ListItem>Others</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style5">Hobbies :</td>
<td class="auto-style3">
<asp:CheckBoxList ID="CheckBoxList2" runat="server" Width="310px">
<asp:ListItem>Eating</asp:ListItem>
<asp:ListItem>Sleeping</asp:ListItem>
<asp:ListItem>Singing</asp:ListItem>
<asp:ListItem>Dancing</asp:ListItem>
<asp:ListItem>Reading</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style13">Phone No. :</td>
<td class="auto-style14">
<asp:TextBox ID="TextBox10" runat="server"></asp:TextBox>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style13">E-Mail :</td>
<td class="auto-style14">
<asp:TextBox ID="TextBox11" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2"
runat="server" ControlToValidate="TextBox11" ErrorMessage="Enter valid email address"
ForeColor="Red" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></
asp:RegularExpressionValidator>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style6">State :</td>
<td class="auto-style7">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>Gujarat</asp:ListItem>
<asp:ListItem>Rajasthan</asp:ListItem>
<asp:ListItem>Mumbai</asp:ListItem>
<asp:ListItem>Pune</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style5">City :</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style5">Pincode :</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style6">Qualification :</td>
<td class="auto-style10">
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem>Diploma</asp:ListItem>
<asp:ListItem>Bachelor</asp:ListItem>
<asp:ListItem>Masters</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style6">Specialization Subject :</td>
<td class="auto-style10">
<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style5">Marks :</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox8" runat="server"></asp:TextBox>
</td>
</tr>
<tr class="newStyle4">
<td class="auto-style2"
colspan="2">&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;&nbsp;
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click1"
Text="Submit" />
<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;
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<asp:Panel ID="Panel1" runat="server">

<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>


<br />
<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>
<br />
<asp:Label ID="Label6" runat="server" Text="Label"></asp:Label>
<asp:Label ID="Label5" runat="server"></asp:Label>
<br />
</asp:Panel>
<br />
</td>
</tr>
</table>
<br />
<br />
<br />
<br />

</div>
</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 PRAC3 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
Panel1.Visible = false;
Response.Write("HELLO! WE ARE GPG STUDENTS");

}
/* protected void Button1_Click(object sender, EventArgs e)
{

Label.Text = "HELLO !" + TextBox9.Text;

}*/
protected void Button1_Click1(object sender, EventArgs e)
{
Panel1.Visible = true;

Label2.Text = "Hello!" + TextBox9.Text;


Label3.Text = "Welcome" + TextBox9.Text;
Label4.Text = "Your Gender is " + RadioButtonList1.SelectedItem.Text;
Label6.Text = "Your hobbies are ";
int i;
for (i = 0; i <= CheckBoxList2.Items.Count - 1; i++)
{
if (CheckBoxList2.Items[i].Selected == true)
{
Label5.Text += CheckBoxList2.Items[i].Text+" , ";
}
}

}
}

You might also like