public frmEditCustomFieldDefIR(clsCustomFieldIRDef _defCustomField)
 {
     InitializeComponent();
     defCustomField = _defCustomField;
 }
        void btnDetailsIR_Click(object sender, EventArgs e)
        {
            string strID = ((Button)sender).Name;
            long lngCustomFieldDefIRID = 0;

            lngCustomFieldDefIRID = Convert.ToInt32(strID.Substring(strID.IndexOf("_") + 1, strID.Length - (strID.IndexOf("_") + 1)));

            Panel panCustomIR = (Panel)pagIRCustom.Controls["panCustomIR_" + lngCustomFieldDefIRID.ToString()];

            clsCustomFieldIRDef defCustomField = new clsCustomFieldIRDef();

            defCustomField.blnRequired = ((CheckBox)panCustomIR.Controls["chkRequiredIR_" + lngCustomFieldDefIRID.ToString()]).Checked;
            defCustomField.blnUseCamper = ((CheckBox)panCustomIR.Controls["chkUseCamperIR_" + lngCustomFieldDefIRID.ToString()]).Checked;
            defCustomField.blnUseLocal = ((CheckBox)panCustomIR.Controls["chkUseLocalIR_" + lngCustomFieldDefIRID.ToString()]).Checked;
            defCustomField.blnUseProfile = ((CheckBox)panCustomIR.Controls["chkUseProfileIR_" + lngCustomFieldDefIRID.ToString()]).Checked;
            defCustomField.lngSortOrder = Convert.ToInt32(((TextBox)panCustomIR.Controls["txtSortOrderIR_" + lngCustomFieldDefIRID.ToString()]).Text);
            defCustomField.mmoFooter = ((TextBox)panCustomIR.Controls["txtFooterIR_" + lngCustomFieldDefIRID.ToString()]).Text;
            defCustomField.mmoHeader = ((TextBox)panCustomIR.Controls["txtHeaderIR_" + lngCustomFieldDefIRID.ToString()]).Text;
            defCustomField.mmoWebCaption = ((TextBox)panCustomIR.Controls["txtWebCaptionIR_" + lngCustomFieldDefIRID.ToString()]).Text;
            defCustomField.strFieldType = ((Label)panCustomIR.Controls["lblFieldTypeIR_" + lngCustomFieldDefIRID.ToString()]).Text;
            defCustomField.strLocalCaption = ((TextBox)panCustomIR.Controls["txtLocalCaptionIR_" + lngCustomFieldDefIRID.ToString()]).Text;
            defCustomField.strDropdownOptions = new List<string>(((TextBox)panCustomIR.Controls["txtDropdownOptionsIR_" + lngCustomFieldDefIRID.ToString()]).Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries));

            frmEditCustomFieldDefIR objEdit = new frmEditCustomFieldDefIR(defCustomField);

            if (objEdit.ShowDialog() == DialogResult.OK)
            {
                //update controls
                 ((CheckBox)panCustomIR.Controls["chkRequiredIR_" + lngCustomFieldDefIRID.ToString()]).Checked=objEdit.defCustomField.blnRequired;
                 ((CheckBox)panCustomIR.Controls["chkUseCamperIR_" + lngCustomFieldDefIRID.ToString()]).Checked=objEdit.defCustomField.blnUseCamper;
                 ((CheckBox)panCustomIR.Controls["chkUseLocalIR_" + lngCustomFieldDefIRID.ToString()]).Checked=objEdit.defCustomField.blnUseLocal;
                 ((CheckBox)panCustomIR.Controls["chkUseProfileIR_" + lngCustomFieldDefIRID.ToString()]).Checked=objEdit.defCustomField.blnUseProfile;
                 ((TextBox)panCustomIR.Controls["txtSortOrderIR_" + lngCustomFieldDefIRID.ToString()]).Text=objEdit.defCustomField.lngSortOrder.ToString();
                 ((TextBox)panCustomIR.Controls["txtFooterIR_" + lngCustomFieldDefIRID.ToString()]).Text=objEdit.defCustomField.mmoFooter;
                 ((TextBox)panCustomIR.Controls["txtHeaderIR_" + lngCustomFieldDefIRID.ToString()]).Text=objEdit.defCustomField.mmoHeader;
                 ((TextBox)panCustomIR.Controls["txtWebCaptionIR_" + lngCustomFieldDefIRID.ToString()]).Text=objEdit.defCustomField.mmoWebCaption;
                 ((Label)panCustomIR.Controls["lblFieldTypeIR_" + lngCustomFieldDefIRID.ToString()]).Text=objEdit.defCustomField.strFieldType;
                 ((TextBox)panCustomIR.Controls["txtLocalCaptionIR_" + lngCustomFieldDefIRID.ToString()]).Text=objEdit.defCustomField.strLocalCaption;

                 ((TextBox)panCustomIR.Controls["txtDropdownOptionsIR_" + lngCustomFieldDefIRID.ToString()]).Text = "";

                 for (int intI = 0; intI < objEdit.defCustomField.strDropdownOptions.Count; intI++)
                     ((TextBox)panCustomIR.Controls["txtDropdownOptionsIR_" + lngCustomFieldDefIRID.ToString()]).Text += objEdit.defCustomField.strDropdownOptions[intI] + "\r\n";
            }
        }
 public frmAddCustomFieldDefIR()
 {
     InitializeComponent();
     defNewField = new clsCustomFieldIRDef();
 }