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.

1.7k questions

3.2k answers

401 users

Categories

1.7k questions

3.2k answers

401 users

I am developing a custom report and the BB-SDK UI Model Wizard generates me the input form. As part of the requirement, I am trying to develop the UI Model with C#. When I generate the UI Model, I don’t see the objects and methods that I have defined in the procedure coming to Visual Studio IDE as I have them in VB.Net.

Is there a part that I am missing? Do you have a reference material / sample on how to develop custom UI model using C#?

asked by abeldebela (232 points)
edited by abeldebela
Sounds like the UIModel didn't get created correctly.  Did the CodeGen.cs file get created?  That should be there with all your Form Fields defined so that you can access them in your .cs file.
I see the objects created in the CodeGen.cs, but I don't get the event handler functions / procedures as I select the object in top menu / drop down boxes.
Event handlers need to be added in C#, there's no "Handles" like there is in VB. In the constructor, add lines for each handler "MyComponent.Event += MyHandler;"
Christi,

I have investigated further implementing the handles in C# but didn't came in handy & easy; Would you please help me understanding this? Say I have one simple data list item “siteid” and one UIActionItem “AddtoLeft”.
How do you define the function with the object?  
Where do you define the function to handle change event for siteid and Invoke action for the AddtoLeft object? Is the CodeGen the right place to do that?

Appreciate your help in this matter.
I posted my reply as an answer to the question because you don't get code styling in comments. Please let me know if that isn't what you were looking for.
Christi,

Thanks for your help to move on.

1 Answer

 
Best answer

When you create a UIModel for a report that has form fields and UI actions/fields, there is a codegen file created as well as a code behind file. In the codegen, the fields and actions will be defined but will not be hooked up to handlers. The code behind file is given an OnCreated method, which the code behind calls after all of the fields have been created.

If you want to add handlers to any of your events, add them in the OnCreated method:

    private void SITEID_ValueChanged(object sender, Blackbaud.AppFx.UIModeling.Core.ValueChangedEventArgs e)
    {
        this.ADDTOLEFT.Invoke();
    }

    partial void OnCreated()
    {
        this.Loaded += ActionsReportUIModel_Loaded;
        this.SITEID.ValueChanged += SITEID_ValueChanged;
    }
answered by christi (717 points)
selected by abeldebela
...