/
newuser2.aspx.cs
166 lines (133 loc) · 5.17 KB
/
newuser2.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
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;
using System.Configuration;
using SampleModel;
public partial class newuser2 : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["StrCon"].ConnectionString);
SampleEntities ObjEntity;
protected void Page_Load(object sender, EventArgs e)
{
ObjEntity = new SampleEntities();
LoadMotherTongueCombo();
if (!IsPostBack)
{
LoadProfileForCombo();
LoadReligionCombo();
LoadCountryCombo();
}
}
// populate profileFor
protected void LoadProfileForCombo()
{
DDl_ProfileFor.Items.Insert(0, new ListItem("--Select--", "0"));
DDl_ProfileFor.Items.Insert(1, new ListItem("Myself", "1"));
DDl_ProfileFor.Items.Insert(2, new ListItem("Son", "2"));
DDl_ProfileFor.Items.Insert(3, new ListItem("Daughter", "3"));
DDl_ProfileFor.Items.Insert(4, new ListItem("Brother", "4"));
DDl_ProfileFor.Items.Insert(5, new ListItem("Sister", "5"));
DDl_ProfileFor.Items.Insert(6, new ListItem("Friend", "6"));
DDl_ProfileFor.Items.Insert(7, new ListItem("Relative", "7"));
}
//Populate Religion
protected void LoadReligionCombo()
{
DDL_Religion.DataSource = ObjEntity.Religions;
DDL_Religion.DataTextField = "ReligionName";
DDL_Religion.DataValueField = "ReligionId";
DDL_Religion.DataBind();
DDL_Religion.Items.Insert(0, new ListItem("--Select--", "0"));
}
//Mother Tongue
protected void LoadMotherTongueCombo()
{
DDL_MotherTongue.DataSource = ObjEntity.MotherTongues;
DDL_MotherTongue.DataTextField = "TongueName";
DDL_MotherTongue.DataValueField = "TongueID";
DDL_MotherTongue.DataBind();
DDL_MotherTongue.Items.Insert(0, new ListItem("--Select--", "0"));
}
//Caste
protected void LoadCasteCombo()
{
int intReligionID;
bool blnCheck = int.TryParse(DDL_Religion.SelectedValue, out intReligionID);
var query = (from m in ObjEntity.Castes
where m.ReligionID == intReligionID
select m).ToList();
DDL_Caste.DataSource = query;
DDL_Caste.DataTextField = "CasteName";
DDL_Caste.DataValueField = "CasteID";
DDL_Caste.DataBind();
DDL_Caste.Items.Insert(0, new ListItem("--Select--", "0"));
}
//Country
protected void LoadCountryCombo()
{
DDL_Country.DataSource = ObjEntity.Countries;
DDL_Country.DataTextField = "CountryName";
DDL_Country.DataValueField = "CountryID";
DDL_Country.DataBind();
DDL_Country.Items.Insert(0, new ListItem("--Select--", "0"));
}
//CountryCode
protected void LoadCountryCodeCombo()
{
int intCountryID;
bool blnCheck = int.TryParse(DDL_Country.SelectedValue, out intCountryID);
var query = (from m in ObjEntity.Countries
where m.CountryID == intCountryID
select m).ToList();
DDL_MobileCode.DataSource = query;
DDL_MobileCode.DataTextField = "CountryCode";
DDL_MobileCode.DataValueField = "CountryName";
DDL_MobileCode.DataBind();
}
protected void DDL_Religion_SelectedIndexChanged(object sender, EventArgs e)
{
LoadCasteCombo();
}
protected void Btn_Submit_Click(object sender, EventArgs e)
{
Session["Sessionname"] = Txt_Name.Text.ToString();
// Session["SessionGender"] = Rbtn_Gender.SelectedValue;
Session["SessionDOB"] = Txt_DOB.Text.ToString();
Session["SessionReligion"] = DDL_Religion.SelectedItem;
Session["SessionMotherTon"] = DDL_MotherTongue.SelectedItem;
//Session["SessionCaste"] = DDL_Caste.SelectedValue.ToList();
Session["SessionCaste"] = DDL_Caste.SelectedItem;
Session["SessionCountry"] = DDL_Country.SelectedItem;
Session["SessionMobile"] = Txt_Phoneno.Text;
Session["SessionEmail"] = Txt_Mail.Text;
Session["SessionPSW"] = Txt_Pwd.Text;
Response.Redirect("Second.aspx");
}
protected void DDL_Country_SelectedIndexChanged(object sender, EventArgs e)
{
LoadCountryCodeCombo();
}
protected void DDl_ProfileFor_SelectedIndexChanged1(object sender, EventArgs e)
{
if (DDl_ProfileFor.SelectedItem.Text == "Son" || DDl_ProfileFor.SelectedItem.Text == "Brother")
{
Lblname.Text = "Groom's Name";
LblGender.Text = "Gender";
}
if (DDl_ProfileFor.SelectedItem.Text == "Daughter" || DDl_ProfileFor.SelectedItem.Text == "sister")
{
Lblname.Text = " Bride's Name";
LblGender.Text = "Gender";
}
if (DDl_ProfileFor.SelectedItem.Text == "myself" || DDl_ProfileFor.SelectedItem.Text == "Relative" || DDl_ProfileFor.SelectedItem.Text == "Friends")
{
Lblname.Text = " Name";
LblGender.Text = " Matrimony profile for";
}
}
}