protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { MyJobPortalModel.SkillType ObjSkillTypeName = new MyJobPortalModel.SkillType(int.Parse(e.Row.Cells[1].Text)); e.Row.Cells[1].Text = ObjSkillTypeName.SkillTypeName; } }
protected void Page_Load(object sender, EventArgs e) { if (this.IsPostBack == false) { TxtSkillType.Focus(); this.Form.DefaultButton = BtnUpdate.UniqueID; MyJobPortalModel.SkillType ObjSkillType = new MyJobPortalModel.SkillType(int.Parse(Request.QueryString["Id"])); TxtSkillType.Text = ObjSkillType.SkillTypeName; DdlStatus.SelectedValue = ObjSkillType.Status; } }
protected void BtnUpdate_Click(object sender, EventArgs e) { if (this.IsValid == true) { bool AllOk = true; DataTable ObjSkillTypeTable = MyJobPortalModel.SkillType.GetSkillTypeRecords("SkillTypeName ='" + TxtSkillType.Text.Replace("'", "''").Trim() + "' and Id<>" + Request.QueryString["Id"]); if ((int)ObjSkillTypeTable.Rows.Count > 0) { LblDuplicateSkillTypeError.Visible = true; AllOk = false; TxtSkillType.Focus(); return; } if (AllOk == true) { MyJobPortalModel.SkillType ObjSkillType = new MyJobPortalModel.SkillType(int.Parse(Request.QueryString["Id"])); ObjSkillType.SkillTypeName = TxtSkillType.Text.Replace("'", "''"); ObjSkillType.Status = DdlStatus.SelectedValue; ObjSkillType.Update(); Response.Redirect("SkillTypeList.aspx?Message=Record has been Updated"); } } }