DATA BIND HERE
public VolunteerSettings() { InitializeComponent(); GetVolunteer(); } private void GetVolunteer() { ConfigurationDAL c = new ConfigurationDAL(); DataTable dt = new DataTable(); drp_Volunteeer.DataSource = c.GetVolunteerList().Tables[0]; drp_Volunteeer.ValueMember = "volunteerid"; drp_Volunteeer.DisplayMember = "volunteername"; }
volunteerid : 12008 Direct Data Get
I Will try drp_volunteer this method data can't get
private void drp_Volunteeer_SelectedIndexChanged(object sender, EventArgs e) { ConfigurationDAL dal = new ConfigurationDAL(); DataTable dt = new DataTable(); dt = dal.FetchVolunteerDetails(volunteerID: 12008).Tables[0]; foreach (DataRow dr in dt.Rows) { txt_FirstName.Text = dr["firstName"].ToString(); txt_fatherName.Text = dr["middleName"].ToString(); txt_Surname.Text = dr["surname"].ToString(); txt_ReportDisplayName.Text = dr["reportDisplayName"].ToString(); txt_address.Text = dr["address"].ToString(); txt_CnicNo.Text = dr["cnic"].ToString(); txt_HomePhone.Text = dr["homephoneNumber"].ToString(); txt_MobilePhone.Text = dr["mobilephonenumber"].ToString(); txt_Email.Text = dr["emailaddress"].ToString(); txt_AcademicQualification.Text = dr["academicqualification"].ToString(); txt_ReligiousQualification.Text = dr["religiousqualification"].ToString(); txt_MaritalStatus.Text = dr["maritalstatus"].ToString(); Rbtn_MedicalInsuranceYes.Checked = Convert.ToBoolean(dr["ismedicalinsurance"]); drp_BloodGroup.Text = dr["bloodgroup"].ToString(); txt_LastTimeBloodDonated.Text = dr["lasttimeblooddonated"].ToString(); txt_Occupation.Text = dr["occupation"].ToString(); txt_FirmName.Text = dr["firmname"].ToString(); txt_WorkAddress.Text = dr["workaddress"].ToString(); txt_Designation.Text = dr["designation"].ToString(); drp_Group.Text = dr["groupName"].ToString(); txt_DateOfBirth.Text = dr["dateofbirth"].ToString(); txt_DateOfJoining.Text = dr["dateofjoining"].ToString(); // drp_CurrentPosition.Text = Convert.ToBoolean(dr["volunteerpositionid"].ToString()); txt_PrevInsitutionName.Text = dr["previnstitutionname"].ToString(); txt_PrevInsitutionJoiningDate.Text = dr["previnstitutionjoiningdate"].ToString(); txt_PrevInsitutionLeavingDate.Text = dr["previnstitutionleavingdate"].ToString(); Rbtn_FireYes.Checked = Convert.ToBoolean(dr["isfirefighting"]); Rbtn_FirstAidYes.Checked = Convert.ToBoolean(dr["isfirstaid"]); Rbtn_EnglishYes.Checked = Convert.ToBoolean(dr["isenglishlanguage"]); Rbtn_BombYes.Checked = Convert.ToBoolean(dr["isbombdisposal"]); Rbtn_CertYes.Checked = Convert.ToBoolean(dr["iscert"]); Rbtn_SecurityYes.Checked = Convert.ToBoolean(dr["issecurity"]); Rbtn_VolunteerYes.Checked = Convert.ToBoolean(dr["isResign"]); txt_DateOfLeaving.Text = dr["dateofleaving"].ToString(); byte[] imgs = (byte[])dr["profilephoto"]; MemoryStream ms = new MemoryStream(imgs); pictureBox1.Image = Image.FromStream(ms); } }
Here Is Stor Proc
ALTER PROCEDURE [dbo].[UIPKGCONFIGURATION_spGetVolunteerList] AS BEGIN SET NOCOUNT ON; select -1 as volunteerid, 'Select volunteer' as volunteername, '1' as dbfullname union select volunteerid, displayfullname as volunteername, dbfullname from tblvolunteer order by dbfullname; END
i will try drp_volunteer.SelectedValue any show me data But not working
Select volunteer value - 1 any value select get data