Announcement

As of April 17, 2018, this site is now in read-only mode. To start new Blackbaud Developer’s discussions, you will find Developer Discussions in the Blackbaud CRM Community.

To post or respond to Blackbaud Community discussions, you will have to login using a www.blackbaud.com login. Learn how to login here. If you have questions or need assistance, please email community@blackbaud.com.

BBIS Troubleshooting – My custom part cannot be cut from a page

By: Joseph Styons

Posted on: May 16, 2013

BBIS parts can be cut and pasted between pages on your site.

This is easily accomplished with the “Cut” link on the part menu.

image

 

The Cut link is implemented behind the scenes by clicking an invisible button.

That means that if you have any enabled field validators in your custom part, the action will silently fail, and the part will remain on the page.

 

There is a workaround for this issue – you can just go to Site Explorer –> Pages and Templates –> Select your page –> Cut the part from there.

image

That works because the validators aren’t part of the outer “Pages and Templates” page.

 

 

But you can also avoid the problem altogether by simply disabling your validators when the page is in design-mode.

Here is code to do just that.

 

    Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If Content.InDesignMode Then
            DisableAllValidators()
        Else
            'Whatever you did in Page_Load before
        End If
    End Sub

    Private Sub DisableAllValidators(Optional ByRef parentControl As Control = Nothing)
        Dim MyObjects As ControlCollection = If(parentControl Is Nothing, Controls, parentControl.Controls)
        'disable any field validators that live on this page.  recursively walk through container controls.
        For Each obj In MyObjects
            Dim ctrl As Control = TryCast(obj, Control)
            If ctrl IsNot Nothing Then
                If ctrl.HasControls Then
                    DisableAllValidators(ctrl) 'recursive
                Else
                    Dim rfv As RequiredFieldValidator = TryCast(obj, RequiredFieldValidator)
                    If rfv IsNot Nothing Then
                        rfv.Enabled = False
                    End If
                End If
            End If
        Next
    End Sub

 

Obligatory link to the handbook

Leave a Reply

Privacy Policy | Sitemap | © 2011 Blackbaud, Inc. All Rights Reserved

Digital Ocean