protected void ibtnsave_Click(object sender, ImageClickEventArgs e) { var otherDal = new OtherDAL(); EBlockedDay objBlockday = new EBlockedDay { BlockedDate = hfBlockDate.Value, BlockedReason = txtBlockReason.Text, IsActive = true }; var sessionContext = IoC.Resolve <ISessionContext>(); //TODO: call by javascript EBlockedDayFranchisee[] objBlockdayFranchisee = GetSelectedFranchisee(); if ((sessionContext.UserSession.CurrentOrganizationRole.CheckRole((long)Roles.FranchisorAdmin)) && ((objBlockdayFranchisee.Length == grdFranchisee.Rows.Count) || (objBlockdayFranchisee.Length == 0))) { objBlockday.IsGlobal = true; } else if (sessionContext.UserSession.CurrentOrganizationRole.CheckRole((long)Roles.FranchiseeAdmin)) { objBlockday.IsGlobal = false; } objBlockday.BlockDayFranchisee = objBlockdayFranchisee.ToList(); Int64 returnresult = otherDal.SaveBlockedDay(objBlockday, Convert.ToInt32(EOperationMode.Insert)); if (returnresult == 0) { returnresult = 9999990; } hfBlockDate.Value = ""; txtBlockDate.Text = ""; txtBlockReason.Text = ""; //setView(ViewState["ViewType"].ToString()); CheckBox chk = (CheckBox)grdFranchisee.HeaderRow.FindControl("chkboxheader"); System.Text.StringBuilder strJsCloseWindow = new System.Text.StringBuilder(); strJsCloseWindow.Append(" <script language = 'Javascript'> document.getElementById('" + chk.ClientID + "').checked=false;GridMasterCheck(); </script>"); ClientScript.RegisterStartupScript(typeof(string), "JSCode", strJsCloseWindow.ToString()); }