private void LoadChoiceForm(int id)
        {
            ResetChoiceForm();

            STD_QUESTION_CHOICE choice = ServiceInterfaceManager.STD_QUESTION_CHOICE_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, id);

            if (choice != null)
            {
                hideFieldChoiceId.Value = choice.STD_QUESTION_CHOICE_ID.ToString();
                txtChoiceName.Text      = choice.CHOICE_NAME;
                txtChoiceSortOrder.Text = choice.CHOICE_SORT_ORDER.GetValueOrDefault().ToString();
                txtChoiceText.Text      = choice.CHOICE_TEXT;
            }
        }
        private bool SaveChoiceForm(ref string strResult)
        {
            STD_QUESTION_CHOICE choice = null;

            if (string.IsNullOrEmpty(txtChoiceName.Text))
            {
                strResult = "Choice Name is Required<br /><br />";
            }
            else if (string.IsNullOrEmpty(txtChoiceSortOrder.Text))
            {
                strResult = "Sort Order is Required<br /><br />";
            }
            else if (string.IsNullOrEmpty(txtChoiceText.Text))
            {
                strResult = "Choice Text is Required<br /><br />";
            }
            else
            {
                // if (!string.IsNullOrEmpty(txtChoiceText.Text))

                int id = 0;
                if (!string.IsNullOrEmpty(hideFieldChoiceId.Value))
                {
                    int.TryParse(hideFieldChoiceId.Value, out id);
                }
                if (id > 0)
                {
                    choice = ServiceInterfaceManager.STD_QUESTION_CHOICE_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, id);
                }
                if (choice == null)
                {
                    choice = new STD_QUESTION_CHOICE();
                }
                else
                {
                    //If text changes, INACTIVATE current choice and save a new one
                    if (txtChoiceText.Text != choice.CHOICE_TEXT)
                    {
                        ServiceInterfaceManager.STD_QUESTION_CHOICE_DELETE(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, choice.STD_QUESTION_CHOICE_ID);
                        choice = new STD_QUESTION_CHOICE();
                    }
                }

                int fieldId = 0;
                if (string.IsNullOrEmpty(hideSurveyFieldId.Value) || !int.TryParse(hideSurveyFieldId.Value, out fieldId))
                {
                    if (SaveForm(ref strResult))
                    {
                        int.TryParse(hideSurveyFieldId.Value, out fieldId);
                        gridSurveyFields.DataBind();
                    }
                    else
                    {
                        strResult = "Error saving Survey Field and Field Choice, please save the Survey Field first before adding choices<br /><br />";
                        return(false);
                    }
                }

                choice.STD_QUESTION_ID = fieldId;
                choice.CREATEDBY       = choice.UPDATEDBY = HttpContext.Current.User.Identity.Name;
                choice.INACTIVE_FLAG   = false;

                choice.CHOICE_NAME = txtChoiceName.Text;
                int sortOrder = 0;
                if (int.TryParse(txtChoiceSortOrder.Text, out sortOrder))
                {
                    choice.CHOICE_SORT_ORDER = sortOrder;
                }
                choice.CHOICE_TEXT = txtChoiceText.Text;

                choice.STD_QUESTION_CHOICE_ID = ServiceInterfaceManager.STD_QUESTION_CHOICE_SAVE(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, choice);
                if (choice.STD_QUESTION_CHOICE_ID > 0)
                {
                    hideFieldChoiceId.Value = choice.STD_QUESTION_CHOICE_ID.ToString();
                    strResult = "Save successful<br /><br />";
                    return(true);
                }
                else
                {
                    strResult = "Error saving Field Choice, please try again<br /><br />";
                }

                //else
                // {
                // strResult = "<ul><li>Choice Name is Required</li></ul>";
                //}
            }
            return(false);
        }