//Display All The Schools public void BindDetails() { School.Registration obj = new School.Registration(); DataSet ds = obj.DisplayCustomRegDet(); //Bind Schools DropDownListSchool.DataTextField = "schname"; DropDownListSchool.DataValueField = "schid"; DropDownListSchool.DataSource = ds.Tables[0]; DropDownListSchool.DataBind(); DropDownListSchool.Items.Insert(0, new ListItem("Select Your School", "")); DropDownListState.Items.Insert(0, new ListItem("select your state", "")); DropDownListState.Items.Insert(0, new ListItem("select you city", "")); //Bind Classes DropDownListClass.DataTextField = "clsnam"; DropDownListClass.DataValueField = "clsid"; DropDownListClass.DataSource = ds.Tables[1]; DropDownListClass.DataBind(); DropDownListClass.Items.Insert(0, new ListItem("Select Your Class", "")); //Bind Sections DropDownListSection.DataTextField = "secnam"; DropDownListSection.DataValueField = "secid"; DropDownListSection.DataSource = ds.Tables[2]; DropDownListSection.DataBind(); DropDownListSection.Items.Insert(0, new ListItem("Select Your Section", "")); ds.Dispose(); ds = null; }
//Method for Registering a New Student private void RegisterStudent() { School.RegistrationProp k = new School.RegistrationProp(); k.name = txtStuName.Text; k.school = Convert.ToInt32(DropDownListSchool.SelectedValue); k.cls = Convert.ToInt32(DropDownListClass.SelectedValue); k.section = Convert.ToInt32(DropDownListSection.SelectedValue); k.dob = Convert.ToDateTime(DropDownListMonth.SelectedValue.ToString() + "/" + DropDownListDay.SelectedValue.ToString() + "/" + DropDownListYear.SelectedValue.ToString()); k.email = txtEmail.Text; k.pwd = txtPassword.Text; k.state = DropDownListState.SelectedValue.ToString(); k.city = DropDownListCity.SelectedValue.ToString(); k.cityCode = Convert.ToInt32(DropDownListCity.SelectedValue); k.genderCode = RadioButtonListGender.SelectedValue; if (txtRollNo.Text == String.Empty) { k.rollno = Convert.ToInt32(0); } else { k.rollno = Convert.ToInt32(txtRollNo.Text); } k.contact = txtContactNumber.Text; k.guid = Guid.NewGuid().ToString(); ViewState["code"] = k.guid; ViewState["email"] = k.email; School.Registration obj = new School.Registration(); Application.Lock(); obj.NewMember(k); Application.UnLock(); }