protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dt = SkillLevelBLL.GetAll(); ddl_SkillLevel.DataSource = dt; ddl_SkillLevel.DataTextField = "SkillLevelName"; ddl_SkillLevel.DataValueField = "SkillLevelId"; ddl_SkillLevel.DataBind(); lbl_message.Visible = false; } }
protected void gv_skills_RowEditing(object sender, GridViewEditEventArgs e) { gv_skills.EditIndex = e.NewEditIndex; gv_skills.DataSource = (DataTable)ViewState["SkillsDT"]; gv_skills.DataBind(); DropDownList ddl_newSkillLvl = ((DropDownList)gv_skills.Rows[e.NewEditIndex].FindControl("ddl_newSkill")); DataTable skilldt = SkillLevelBLL.GetAll(); ddl_newSkillLvl.DataSource = skilldt; ddl_newSkillLvl.DataTextField = "SkillLevelName"; ddl_newSkillLvl.DataValueField = "SkillLevelId"; ddl_newSkillLvl.DataBind(); ddl_newSkillLvl.SelectedValue = ((DataTable)ViewState["SkillsDT"]).Rows[e.NewEditIndex]["SkillLevelId"].ToString(); }