protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DDLCollege.DataSource = Participant.GetAllColleges(); DDLCollege.DataBind(); ListItem li = new ListItem(); li.Text = "Other College"; li.Value = "-1"; DDLCollege.Items.Add(li); DDLBranch.DataSource = Participant.GetAllBranches(); DDLBranch.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { Dictionary <int, string> colleges = new Dictionary <int, string>(); foreach (DataRow row in Participant.GetColleges().Tables[0].Rows) { colleges.Add((int)row["CollegeID"], (string)row["CollegeName"]); } ListItem li = new ListItem(); li.Text = "Other College"; li.Value = "-1"; DDLCollege.DataSource = colleges.OrderBy(x => x.Key).ToList().Skip(1).OrderBy(x => x.Value); DDLCollege.DataBind(); DDLCollege.Items.Add(li); DDLBranch.DataSource = Participant.GetBranches(); DDLBranch.DataBind(); if (Session["EmailID"] != null) { pnlProfile.Visible = true; btnRegisterLogin.Visible = false; Participant participant = Participant.GetParticipantDetails(Session["EmailID"].ToString()); lblParticipantName.Text = participant.Name.Split(' ')[0]; drpdwnProfileCollege.DataSource = colleges.OrderBy(x => x.Key).ToList().Skip(1).OrderBy(x => x.Value); drpdwnProfileCollege.DataBind(); drpdwnProfileCollege.Items.Add(li); drpdwnProfileBranch.DataSource = Participant.GetBranches(); drpdwnProfileBranch.DataBind(); drpdwnProfileBranch.SelectedIndex = drpdwnProfileBranch.Items.IndexOf(drpdwnProfileBranch.Items.FindByValue(participant.Branch.ToString())); drpdwnProfileCollege.SelectedIndex = drpdwnProfileCollege.Items.IndexOf(drpdwnProfileCollege.Items.FindByValue(participant.CollegeID.ToString())); txtbxProfileStudentNumber.Text = participant.StudentNo; txtbxProfileName.Text = participant.Name; txtbxProfileEmail.Text = participant.EmailID; txtbxProfileContactNo.Text = participant.ContactNo; chkbxProfileWantTshirt.Checked = participant.WantTShirt; chkbxWantAccomodation.Checked = participant.WantAccomodation; rblProfileGender.SelectedIndex = rblProfileGender.Items.IndexOf(rblProfileGender.Items.FindByText(participant.Gender.ToString())); drpdwnProfileYear.SelectedIndex = drpdwnProfileYear.Items.IndexOf(drpdwnProfileYear.Items.FindByValue(participant.Year.ToString())); if (participant.PartnerID == 0) { txtbxProfilePartnerId.Text = ""; } else { txtbxProfilePartnerId.Text = "TT" + participant.PartnerID.ToString(); } if (drpdwnProfileCollege.SelectedItem.Value == "-1") { profileCollegeDiv.Visible = true; } else { profileCollegeDiv.Visible = false; } if (drpdwnProfileCollege.SelectedItem.Value != "1") { profileStudentNumberDiv.Visible = false; profileAccomodationDiv.Visible = true; profilePartnerIdDiv.Visible = true; } else { profileStudentNumberDiv.Visible = true; profileAccomodationDiv.Visible = false; profilePartnerIdDiv.Visible = false; } LblTTID.Text = "TT" + participant.TTID; } }