protected void PromotionGV_RowUpdating(object sender, GridViewUpdateEventArgs e) { clearMsgPanel(); int index = PromotionGV.EditIndex; GridViewRow row = PromotionGV.Rows[index]; DropDownList PrevBranch = (DropDownList)row.FindControl("DropPrevBranch"); DropDownList ExpectedBranch = (DropDownList)row.FindControl("DropExpecBranch"); TextBox MinNo = (TextBox)row.FindControl("txtMinNo"); DropDownList jTitle = (DropDownList)row.FindControl("DropDJobTitle"); DropDownList status = (DropDownList)row.FindControl("DropDStatus"); TextBox PromotionDate = (TextBox)row.FindControl("txtPromotionDate"); string tempPromotionDate = null; try { tempPromotionDate = Convert.ToDateTime(PromotionDate.Text).ToShortDateString(); } catch (FormatException) { msgPanel.Visible = true; ErroroDIV.Visible = true; lblErrorMsg.Text = "Please check the Promotion date & try again."; return; } catch (Exception) { msgPanel.Visible = true; ErroroDIV.Visible = true; lblErrorMsg.Text = "Something went wrong please contact your system administrator"; return; } promotion.PrevBranch = PrevBranch.SelectedValue; promotion.Branch = ExpectedBranch.SelectedValue; promotion.MinuteNo = MinNo.Text.Trim(); promotion.Post = jTitle.SelectedValue; promotion.Status = status.SelectedValue; promotion.PromotionDate = tempPromotionDate; promotionManagement = new PromotionManager(promotion); promotionManagement.UpdatePromotedemployee(); PromotionGV.EditIndex = -1; DataTable getds = null; if (isAllPromotion) { getds = promotionManagement.getAllPromotedEmployee(promotionStatus, dateStart.Text.Trim(), DateEnd.Text.Trim()); } else { getds = promotionManagement.getSpecifiedPromotionResult(postID, isPromoAssigned); } BindDataSetToGV(getds); }