public void BindUserCode() { string status = "UnPlaced"; SqlCommand cmd1 = new SqlCommand("SELECT * FROM Placement_Registration where OrgId='" + orgId.ToString() + "'and Status='" + status + "'", cn); SqlDataAdapter adp1 = new SqlDataAdapter(cmd1); DataSet ds1 = new DataSet(); adp1.Fill(ds1); DDUserCode.DataSource = ds1; DDUserCode.DataTextField = "UserCode"; DDUserCode.DataValueField = "UserCode"; DDUserCode.DataBind(); DDUserCode.Items.Insert(0, new ListItem("--Select UserCode--", "0")); }
protected void DDUserCode_SelectedIndexChanged(object sender, EventArgs e) { DDUserCode.Focus(); try { //FETCH DATA if (DDUserCode.SelectedValue != "0") { SqlCommand cmd1 = new SqlCommand("SELECT FirstName, Address,Mobile,pemail,Company_Name,Company_Address,Position FROM Placement_Registration where OrgId='" + orgId.ToString() + "'and UserCode='" + DDUserCode.SelectedValue + "'", cn); SqlDataAdapter adp1 = new SqlDataAdapter(); DataSet ds1 = new DataSet(); adp1.SelectCommand = cmd1; adp1.Fill(ds1); txtStudentName.Text = ds1.Tables[0].Rows[0]["FirstName"].ToString(); txtAddress.Text = ds1.Tables[0].Rows[0]["Address"].ToString(); txtMobile.Text = ds1.Tables[0].Rows[0]["Mobile"].ToString(); txtEmail.Text = ds1.Tables[0].Rows[0]["pemail"].ToString(); txtCompanyName.Text = ds1.Tables[0].Rows[0]["Company_Name"].ToString(); txtCompanyAddress.Text = ds1.Tables[0].Rows[0]["Company_Address"].ToString(); // txtposition.Text = ds1.Tables[0].Rows[0]["Position"].ToString(); a = db.getDb_Value("select CourseId from tblStudent where OrgId='" + orgId.ToString() + "' and UserCode='" + DDUserCode.SelectedValue + "'"); txtCourseName.Text = db.getDbstatus_Value("select CourseName from tblCourse where CourseId='" + a.ToString() + "' and OrgId='" + orgId.ToString() + "'"); b = db.getDb_Value("select BranchId from tblStudent where OrgId='" + orgId.ToString() + "' and UserCode='" + DDUserCode.SelectedValue + "'"); txtBranchName.Text = db.getDbstatus_Value("select BranchName from tblBranch where BranchId='" + b.ToString() + "'and CourseId='" + a.ToString() + "'"); } else { ClearData(); } } catch (Exception ex) { msgBox.ShowMessage("Record Not Found!!!", "Information", UserControls.MessageBox.MessageStyle.Information); } }