-
Notifications
You must be signed in to change notification settings - Fork 0
/
Student_Registeration.aspx.cs
168 lines (144 loc) · 5.38 KB
/
Student_Registeration.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class Student_Registeration : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("Data Source=AKKI-PC\\SATYAMMSSQL;Initial Catalog=CIS;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
}
protected void val(object source, ServerValidateEventArgs args)
{
if (Contactno.Text.Length < 10)
{
args.IsValid = false;
}
}
protected void TextBox20_TextChanged(object sender, EventArgs e)
{
}
protected void DropDownList16_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList16.Text == "Percentage")
{
Label24.Visible = true;
Label24.Text = "Enter Percentage";
Hcp.Visible = true;
}
else
{
Label24.Visible = true;
Label24.Text = "Enter Grade";
Hcp.Visible = true;
}
}
protected void Button3_Click(object sender, EventArgs e)
{
con.Open();
string str = FileUpload1.FileName;
FileUpload1.PostedFile.SaveAs(Server.MapPath(".") + "//uploads//" + str);
string path = "~//student//" + str.ToString();
SqlCommand cmd = new SqlCommand("Insert into student values('" + id.Text + "','" + Fname.Text + "','" + Mname.Text + "','" + LName.Text + "','" + Email.Text + "','" + Fathername.Text + "','" + Mothername.Text + "','" + Contactno.Text + "','" + Address.Text + "','" + Gender.SelectedItem + "','" + DateOfBirth.Text + "','" + Pass.Text + "','" + collegeid.Text + "','" + DdlMd.SelectedItem + "','" + DdlMdc.SelectedItem + "','" + DdlMdy.SelectedItem + "','" + Mdp.Text + "','" + DdlGd.SelectedItem + "','" + DdlGdc.SelectedItem + "','" + DdlGdy.SelectedItem + "','" + Gdp.Text + "','" + Icn.Text + "','" + DdlIb.SelectedItem + "','" + Ip.Text + "','" + DdlIy.SelectedItem + "','" + Hcn.Text + "','" + DdlHb.SelectedItem + "','" + Hcp.Text + "','" + DdlHy.SelectedItem + "','" + path + "')", con);
cmd.ExecuteNonQuery();
con.Close();
Page.RegisterStartupScript("UserMsg", "<script>alert('Thank you for Registration...')</script>");
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
}
protected void TextBox25_TextChanged(object sender, EventArgs e)
{
}
protected void DropDownList3_SelectedIndexChanged1(object sender, EventArgs e)
{
if (DropDownList3.Text == "Percentage")
{
Label26.Visible = true;
Label26.Text = "Enter Percentage";
Ip.Visible = true;
}
else
{
Label26.Visible = true;
Label26.Text = "Enetr Grade";
Ip.Visible = true;
}
}
protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)
{
if (DropDownList1.Text == "Percentage")
{
Label12.Visible = true;
Label12.Text = "Enter Percentage";
Mdp.Visible = true;
}
else
{
Label12.Visible = true;
Label12.Text = "Enter Grade";
Mdp.Visible = true;
}
}
protected void DropDownList2_SelectedIndexChanged1(object sender, EventArgs e)
{
if (DropDownList2.Text == "Percentage")
{
Label32.Visible = true;
Label32.Text = "Enter Percentage";
Gdp.Visible = true;
}
else
{
Label32.Visible = true;
Label32.Text = "Enetr Grade";
Gdp.Visible = true;
}
}
protected void id_TextChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(id.Text))
{
con.Open();
SqlCommand cmd2 = new SqlCommand("select * from student where studentid=@studentid", con);
cmd2.Parameters.AddWithValue("@studentid", id.Text);
SqlDataReader dr = cmd2.ExecuteReader();
if (dr.HasRows)
{
userid.Text = "StudentId already exist";
userid.ForeColor = System.Drawing.Color.Red;
}
else
{
userid.Text = "New Student";
userid.ForeColor = System.Drawing.Color.Green;
}
con.Close();
}
}
protected void collegeid_TextChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(collegeid.Text))
{
con.Open();
SqlCommand cmd3 = new SqlCommand("select * from college where collegeid=@collegeid", con);
cmd3.Parameters.AddWithValue("@collegeid", collegeid.Text);
SqlDataReader dr = cmd3.ExecuteReader();
if (dr.HasRows)
{
collegename.Text = " Registered College ";
collegename.ForeColor = System.Drawing.Color.Green;
}
else
{
collegename.Text = "Unregistered College";
collegename.ForeColor = System.Drawing.Color.Red;
}
con.Close();
}
}
}