/// <summary>
 /// Handles the Rebind event of the gFields control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void gFields_Rebind( object sender, EventArgs e )
 {
     if ( RebindFieldClick != null )
     {
         var eventArg = new AttributeFormFieldEventArg( FormGuid );
         RebindFieldClick( this, eventArg );
     }
 }
 /// <summary>
 /// Handles the Reorder event of the gFields control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param>
 protected void gFields_Reorder( object sender, GridReorderEventArgs e )
 {
     if ( ReorderFieldClick != null )
     {
         var eventArg = new AttributeFormFieldEventArg( FormGuid, e.OldIndex, e.NewIndex );
         ReorderFieldClick( this, eventArg );
     }
 }
 /// <summary>
 /// Handles the Add event of the gFields control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void gFields_Add( object sender, EventArgs e )
 {
     if ( AddFieldClick != null )
     {
         var eventArg = new AttributeFormFieldEventArg( FormGuid, Guid.Empty );
         AddFieldClick( this, eventArg );
     }
 }
 /// <summary>
 /// Handles the Edit event of the gFields control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param>
 protected void gFields_Edit( object sender, RowEventArgs e )
 {
     if ( EditFieldClick != null )
     {
         var eventArg = new AttributeFormFieldEventArg( FormGuid, (Guid)e.RowKeyValue );
         EditFieldClick( this, eventArg );
     }
 }
        /// <summary>
        /// Tfes the form_ reorder attribute click.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void tfeForm_ReorderFieldClick( object sender, AttributeFormFieldEventArg e )
        {
            ParseEditControls();

            var form = FormState.FirstOrDefault( f => f.Guid == e.FormGuid );
            if ( form != null )
            {
                SortFields( form.Fields, e.OldIndex, e.NewIndex );
                ReOrderFields( form.Fields );
            }

            BuildEditControls( true, e.FormGuid );
        }
        /// <summary>
        /// Tfes the form_ rebind attribute click.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void tfeForm_RebindFieldClick( object sender, AttributeFormFieldEventArg e )
        {
            ParseEditControls();

            BuildEditControls( true, e.FormGuid );
        }
        /// <summary>
        /// Tfes the form_ edit attribute click.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void tfeForm_EditFieldClick( object sender, AttributeFormFieldEventArg e )
        {
            ParseEditControls();

            ShowFormFieldEdit( e.FormGuid, e.FormFieldGuid );

            BuildEditControls( true );
        }
        /// <summary>
        /// Tfes the form_ delete attribute click.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void tfeForm_DeleteFieldClick( object sender, AttributeFormFieldEventArg e )
        {
            ParseEditControls();

            var form = FormState.FirstOrDefault( f => f.Guid == e.FormGuid );
            if ( form != null )
            {
                var field = form.Fields.FirstOrDefault( f => f.Guid == e.FormFieldGuid );
                if ( field != null )
                {
                    form.Fields.Remove( field );
                }
            }

            BuildEditControls( true, e.FormGuid );
        }
        /// <summary>
        /// Tfes the form_ add attribute click.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void tfeForm_AddFieldClick( object sender, AttributeFormFieldEventArg e )
        {
            ParseEditControls();

            ShowFormFieldEdit( e.FormGuid, Guid.NewGuid() );

            BuildEditControls( true );
        }