Loading
Uniconta
  • Search
  • Uniconta
    • Functions
      • General ledger
      • Orders & Purchase
      • Inventory & Logistics
      • Project
      • Production
      • Dashboard
      • Business Rules
      • ODATA ikonCustomisation
      • See all →
    • Apps
      • Invoice App Create Invoices
      • Upload App Submit reciepts & expenses
      • Assistant App Project Management
      • Work App Time Tracking
      • Authenticator App Two-Factor Authentication
    • Integrations
      • Add-on Store
    • Download & Login
      • Download Uniconta
      • Web Login
  • Developers
    • Build & Integrate
      • Get API Key
      • Download for Developers
      • Documentation
    • Resources & Code
      • Samples
      • Add-on solutions and users
    • Partner Ecosystem
      • Become an integration partner
      • Partner Portal
  • Insights
    • News
      • Latest News
      • Release Notes
      • Customer Stories
    • Get started
      • Try Uniconta
      • Book a Demo
  • Contact
  • Get Uniconta
  • Contact us
  • Find a reseller
Free trial signup

Developers Unipedia

  • API
    • API
    • User defined fields
    • User defined tables
    • Saving a Session
    • Posting an Invoice
    • Post Invoice and get PDF
    • Localization
    • Attach physical voucher to entities
    • Server-Login User
    • How to find C# Property from Uniconta Label
    • Minimize network traffic and optimize speed
    • Export pictures from Uniconta
    • OIOUBL Document Mapping and Send (NemHandel)
  • Plugins
    • Plugins
    • Debug Uniconta Plugins
    • Refreshing UI with plugins
    • How to use Uniconta Plugin
    • Develop a user plugin
    • Business Rules – User Plugins
    • Event Handling
    • Global Script
    • How to capture menu events
    • How to open a form in Uniconta from Plugin
    • Open new content in a IContentPluginBase plugin
    • Adding plugin in a menu
    • How to add user parameter in plugin menu
    • How to create plugin with Devexpress Library
    • Synchronize Entity Support in form page
    • Develop a PageEventBase Plugin
    • Logging Exceptions on local machine
    • Create Custom Uniconta Pages From Github Code
    • Web frame integration
  • OData
    • CRUD operations in OData
    • ODATA REST API – Testing with Postman

Refreshing UI with plugins

October 2nd, 2018 January 7th, 2021 < 1 minute
Print Friendly, PDF & Email

There are two different ways to refresh the UI from plugins, depending on the plugin type you are developing.

The way to refresh in IContentPluginBase is the same as IPluginBase.

Refreshing with IPluginBase

IPluginBase plugins have the following EventHandler:

public event EventHandler OnExecute;

The following code snippet can be called from the method Execute(...) to refresh the UI of the Grid Page.

PluginEventArgs arg = new PluginEventArgs();
arg.EventType = PluginEvent.RefreshGrid;
OnExecute(null, arg);

To exemplify this, here is an example plugin that can be used to double the amount of OrderLines on an Order.

/*
* Creates dummy data by doubling the amount of DebtorOrderLines
*/
public ErrorCodes Execute(UnicontaBaseEntity master, UnicontaBaseEntity currentRow, IEnumerable<UnicontaBaseEntity> source, string command, string args)
{
    // Cast source to its run time type.
    var allLines = (IEnumerable<DebtorOrderLineClient>) source;
    var newLines = new List<DebtorOrderLineClient>();
    // Loop over all lines and Insert an extra line.
    foreach (var line in allLines)
    {
        var newLine = new DebtorOrderLineClient
        {
            Item = line.Item,
            Price = line.Price,
            Text = line.Text,
            Date = DateTime.Now,
         };
         newLines.Add(newLine);
         newLine.SetMaster(master);
    }
            
    // Insert new order lines. 
    var result = Crud.Insert(newLines).Result;
    // Call refresh code to update UI automatically.
    PluginEventArgs arg = new PluginEventArgs();
    arg.EventType = PluginEvent.RefreshGrid;
    OnExecute(null, arg);
    return result;
}

Refreshing with PageEventsBase

You can take theRefreshGrid() method and paste into your own code base. Now you can just call RefreshGrid when you want to refresh the UI.

Note that this will call some events of the PageEventsBase. For instance, if this method is called from RecrodPropertyChanged, it results in an infinite loop.

private void RefreshGrid()
{
    var methodInfo = this.page.GetType().GetMethod("Filter", new Type[] { });
    if (methodInfo != null)
        methodInfo.Invoke(this.page, null);
}

 

Categories: API, Developers Unipedia, Plugins
Home » Plugins » Refreshing UI with plugins

Get in touch with us

Uniconta

  • Uniconta
  • Modules
  • Downloads
  • Free trial signup
  • Subscription Terms
  • Privacy Policy
  • System Status

PARTNER

  • Resellers
  • For Developers
  • Uniconta API key application
  • Uniconta Partner info

Info

  • News
  • Updates
  • Customer cases
  • Video
  • IT Security
  • Backup procedure – global
  • About us

Support

  • Unipedia
  • API information
  • Contacts
© Uniconta  2026

facebook linkedin youtube

  • Visit a Country Site
    • Dansk
    • Uniconta GermanyDeutsch
    • Eesti
    • Uniconta GermanyÍslenska
    • Lietuva
    • Uniconta NetherlandsNederlands
    • Norsk
    • English