protected void btnSubmit1_Click(object sender, EventArgs e)
        {
            //if (DropDownCountry.SelectedIndex > 0 && DropDownState.SelectedIndex > 0 && txtGroupName.Text.Trim() != string.Empty && txtAddress1.Text.Trim() != string.Empty && txtCity.Text.Trim() != string.Empty)
            ////if (txtGroupName.Text.Trim().Length > 0 && txtLastName.Text.Trim().Length > 0 && txtEmail.Text.Trim().Length > 0 && Convert.ToInt16(DropDownGroup.SelectedItem.Value)>0)
            //{
            if (btnSubmit1.Text.Equals("Submit"))
            {

                if (hdneditId.Value != null && hdneditId.Value != "" && int.Parse(hdneditId.Value.ToString()) > 0)
                {

                    AccreditationDataContext objDB = new AccreditationDataContext();
                    objDB.Connection.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["constr"];
                    using (AccreditationDataContext group = new AccreditationDataContext())
                    {
                        LINQ.TblGroupCreation grp = objDB.TblGroupCreations.First(D => D.GrpId == int.Parse(hdneditId.Value.ToString()));
                        if (grp.GrpName.Trim() == txtGroupName.Text.Trim())
                        {
                            grp.GrpName = txtGroupName.Text.Trim();
                            grp.Address1 = txtAddress1.Text.Trim();
                            grp.Address2 = txtAddress2.Text.Trim();
                            grp.City = txtCity.Text.Trim();
                            grp.StateId = Convert.ToInt16(DropDownState.SelectedItem.Value);
                            grp.Zipcode = txtZipcode.Text;
                            grp.CountryId = Convert.ToInt16(DropDownCountry.SelectedItem.Value);
                            grp.Active = true;
                            objDB.SubmitChanges();
                            showOutputMessage((int)BLL.Constants.MessageType.Success, "Group updated successfully.");
                        }
                        else
                        {
                            if (!IsExistGroup(txtGroupName.Text.Trim(), int.Parse(hdneditId.Value.ToString())))
                            {
                                grp.GrpName = txtGroupName.Text.Trim();
                                grp.Address1 = txtAddress1.Text.Trim();
                                grp.Address2 = txtAddress2.Text.Trim();
                                grp.City = txtCity.Text.Trim();
                                grp.StateId = Convert.ToInt16(DropDownState.SelectedItem.Value);
                                grp.Zipcode = txtZipcode.Text;
                                grp.CountryId = Convert.ToInt16(DropDownCountry.SelectedItem.Value);
                                grp.Active = true;
                                objDB.SubmitChanges();
                                showOutputMessage((int)BLL.Constants.MessageType.Success, "Group updated successfully.");
                            }
                            else
                            {
                               // Response.Write("<script>alert('This Group Name Already exist.')</script>");
                                showOutputMessage((int)BLL.Constants.MessageType.Fail, "This Group Name Already exist.");
                                return;
                                //Utilities.CreateMessageLabel(this, BLL.Constants.UnableToCreateGroup, false);
                            }
                        }

                    }

                }
                else
                {
                    if (!IsExistGroup(txtGroupName.Text.Trim(), 0))
                    {
                        using (AccreditationDataContext group = new AccreditationDataContext())
                        {
                            TblGroupCreation group1 = new TblGroupCreation
                            {
                                GrpName = txtGroupName.Text.Trim(),
                                Address1 = txtAddress1.Text.Trim(),
                                Address2 = txtAddress2.Text.Trim(),
                                City = txtCity.Text.Trim(),
                                StateId = Convert.ToInt16(DropDownState.SelectedItem.Value),
                                Zipcode = txtZipcode.Text,
                                CountryId = Convert.ToInt16(DropDownCountry.SelectedItem.Value),
                                Active = true,
                            };
                            group.Connection.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["constr"];
                            group.TblGroupCreations.InsertOnSubmit(group1);
                            group.SubmitChanges();
                            showOutputMessage((int)BLL.Constants.MessageType.Success, "Group created successfully.");

                        }
                    }
                    else
                    {
                       // Response.Write("<script>alert('This Group Name Already exist.')</script>");
                        showOutputMessage((int)BLL.Constants.MessageType.Fail, "This Group Name Already exist.");
                        return;
                        //Utilities.CreateMessageLabel(this, BLL.Constants.UnableToCreateGroup, false);
                    }

                }

            }

            Response.AddHeader("REFRESH", "5;URL=GroupList.aspx");
            //Response.Redirect("GroupList.aspx");
            return;
        }
		private void detach_TblGroupCreations(TblGroupCreation entity)
		{
			this.SendPropertyChanging();
			entity.TblCountry = null;
		}
 partial void DeleteTblGroupCreation(TblGroupCreation instance);
 partial void UpdateTblGroupCreation(TblGroupCreation instance);
 partial void InsertTblGroupCreation(TblGroupCreation instance);
		private void attach_TblGroupCreations(TblGroupCreation entity)
		{
			this.SendPropertyChanging();
			entity.TblState = this;
		}