/// <summary> /// Method to bind role skills to ddlRoleSkills Control /// </summary> private void BindRoleSkills() { DataSet dsRoles = new DataSet(); CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL(); try { dsRoles = currentDesiredJobBAL.GetRoleSkillsBAL(); // Check dataset is not null if (dsRoles != null) { ddlRoleSkills.DataSource = dsRoles; ddlRoleSkills.DataTextField = "RoleName"; ddlRoleSkills.DataValueField = "RoleId"; ddlRoleSkills.DataBind(); ddlRoleSkills.Items.Insert(Convert.ToInt32(ddlRoleSkills.Items.Count), new ListItem("----Other----", "")); ddlRoleSkills.Items.Insert(0, new ListItem("--Select--", "0")); } } catch (Exception) { // throw; } }
/// <summary> /// Handles ItemDataBound event of rptrRoleSkills control /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void rptrRoleSkills_ItemDataBound(object sender, RepeaterItemEventArgs e) { DataSet dsRoleSkill = new DataSet(); CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL(); dsRoleSkill = currentDesiredJobBAL.ViewRoleSkillDetailsBAL(candidateId); string fromDate, tillDate; fromDate = Convert.ToString(dsRoleSkill.Tables[0].Rows[0]["FromDate"]); ; string[] Words = fromDate.Split(new char[] { '/' }); int count = 0; tillDate = Convert.ToString(dsRoleSkill.Tables[0].Rows[0]["TillDate"]); ; string[] Words1 = tillDate.Split(new char[] { '/' }); int count1 = 0; DropDownList ddlRoleSkill = (DropDownList)e.Item.FindControl("ddlRoleSkill"); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataSet dsRoles = new DataSet(); dsRoles = currentDesiredJobBAL.GetRoleSkillsBAL(); if (dsRoles != null) { ddlRoleSkill.DataSource = dsRoles; ddlRoleSkill.DataTextField = "RoleName"; ddlRoleSkill.DataValueField = "RoleId"; ddlRoleSkill.DataBind(); ddlRoleSkill.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "RoleSkills")); } } DropDownList ddlFromYear = (DropDownList)e.Item.FindControl("ddlFromYear"); DropDownList ddlFromMonth = (DropDownList)e.Item.FindControl("ddlFromMonth"); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { List<string> monthList = CommonUtil.Utility.GetMonths(); ddlFromMonth.DataSource = monthList; ddlFromMonth.DataBind(); List<string> yearList = CommonUtil.Utility.GetYears(); ddlFromYear.DataSource = yearList; ddlFromYear.DataBind(); foreach (string Word in Words) { count += 1; if (count == 1) { ddlFromMonth.SelectedValue = Word; } if (count == 2) { ddlFromYear.SelectedValue = Word; } } } DropDownList ddlTillYear = (DropDownList)e.Item.FindControl("ddlTillYear"); DropDownList ddlTillMonth = (DropDownList)e.Item.FindControl("ddlTillMonth"); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { List<string> monthList = CommonUtil.Utility.GetMonths(); ddlTillMonth.DataSource = monthList; ddlTillMonth.DataBind(); List<string> yearList = CommonUtil.Utility.GetYears(); ddlTillYear.DataSource = yearList; ddlTillYear.DataBind(); foreach (string Word in Words1) { count1 += 1; if (count1 == 1) { ddlTillMonth.SelectedValue = Word; } if (count1 == 2) { ddlTillYear.SelectedValue = Word; } } } DropDownList ddlProficiency = (DropDownList)e.Item.FindControl("ddlProficiency"); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { ddlProficiency.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "Proficiency")); } }