protected void acbRelation_SaveClick(object sender, EventArgs e)
        {
            int result = 0;
            objRelationLookUp = new RelationLookUpDal();
            switch (acbRelation.SaveButton.CommandName)
            {
                case "Save":
                    Save();
                    pnlAddNewMode.Visible = false;
                    acbRelation.EditableMode = false;

                    break;

                case "Update":
                    String xmlData = GenerateXmlString(radgrdRelation);
                    result = objRelationLookUp.UpdateRelation(xmlData);
                    if (result == 1)
                    {
                        acbRelation.DefaultMode = true;
                        Master.DisplayMessage(ConfigurationSettings.AppSettings["UpdateRecord"].ToString());
                        Master.MessageCssClass = "successMessage";

                        if (ViewState[PageConstants.vsItemIndexes] != null)
                            htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes];
                        for (int i = 0; i < htItemIndex.Count; i++)
                            radgrdRelation.Items[Convert.ToInt32(htItemIndex[i])].Edit = false;
                        bisEdit = false;
                        ViewState[PageConstants.vsItemIndexes] = null;
                        BindGrid();
                    }
                    else
                    {
                        Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Update].ToString());
                        Master.MessageCssClass = "errorMessage";
                    }
                    break;
            }
            objRelationLookUp = new RelationLookUpDal();

        }
 private void Save()
 {
     try
     {
         int result = 0;
         objRelationLookUp = new RelationLookUpDal();
         objLookupBDto = new LookupBDto();
         objLookupBDto.LookupName = txtRelationDesc.Text;
         objLookupBDto.UserProfile = objAuthorizationBDto.UserProfile;
         result = objRelationLookUp.InsertRelation(objLookupBDto);
         if (result >= 1)
         {
             Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
             Master.MessageCssClass = "successMessage";
         }
         else
         {
             Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString());
             Master.MessageCssClass = "errorMessage";
         }
         BindGrid();
         Reset();
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
         if (rethrow)
         { throw ex; }
     }
 }
        protected void acbRelation_SearchClick(object sender, EventArgs e)
        {
            try
            {
                acbRelation.SearchTextBox.Focus();
                objRelationLookUp = new RelationLookUpDal();
                DataSet dsRelation = objRelationLookUp.GetRelation(acbRelation.SearchTextBox.Text);
                radgrdRelation.DataSource = dsRelation;
                radgrdRelation.DataBind();
                ViewState[vsRelation] = dsRelation;
                Reset();
            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }


        }
        /// <summary>
        /// Bind Relation grid
        /// </summary>

        private void BindGrid()
        {
            objRelationLookUp = new RelationLookUpDal();
            DataSet dsRelation = objRelationLookUp.GetRelation("");
            radgrdRelation.DataSource = dsRelation;
            radgrdRelation.DataBind();
            ViewState[vsRelation] = dsRelation;
        }
        protected void acbRelation_DeleteClick(object sender, EventArgs e)
        {
            try
            {
                StringBuilder RelationId = new StringBuilder();
                int result = 0;
                if (ViewState[PageConstants.vsItemIndexes] != null)
                    htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes];

                if (htItemIndex != null)
                {
                    foreach (int i in htItemIndex.Values)
                    {

                        Label lblRelationId = (Label)radgrdRelation.Items[i].FindControl("lblgrdRelationIdItem");
                        if (lblRelationId != null)
                        {
                            RelationId.Append(lblRelationId.Text + ",");
                        }
                    }
                }

                objRelationLookUp = new RelationLookUpDal();
                String RelaId = RelationId.ToString().TrimEnd(',');
                result = objRelationLookUp.DeleteRelation(RelaId);


                if (result == 1)
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Delete].ToString());
                    Master.MessageCssClass = "successMessage";
                    ViewState[PageConstants.vsItemIndexes] = null;
                    BindGrid();
                }
                else if (result == 547)
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Delete].ToString());
                    Master.MessageCssClass = "errorMessage";
                }
            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }

        }