DevEx Dashboard Extension - how to override a method?

0
0

Hi.

I have been able to work with the AspNetControl DevEx Dashboard wrapper setting the control’s Properties and using its Events. Now I need to override one of its Methods ( https://supportcenter.devexpress.com/ticket/details/t711096/web-dashboard-with-choropleth-map-change-url-on-dashboard-load ).

Could you guys give me a sample on what would be the proper way to do it?

Thanks in advance.

Ivan
(Wisej 2.2.46.0 – VS 2019 – C# – SQLServer)

  • You must to post comments
0
0

Hi Levie.

Any thoughts on this one?

Cheers.

Ivan

  • Levie (ITG)
    Hi Ivan, I know it’s been a few days, I apologize for the wait! I’m waiting to hear back from DX support on a license issue and then I’ll get this tested and get you a proper answer. Best, Levie
  • Ivan Borges
    That is great, Levie! Thank you so much. Let me know if I can help in any way.
  • You must to post comments
0
0

Hi Levie.

Thanks for the reply.

I have been facing exceptions on the Map loading which the DevEx support is not able to reproduce, nor am I when using a plain ASP.NET application. However, once run in the Wisej AspNetWrapper control, I keep getting an exception stating the “document” was null:


Friday, April 2, 2021 3:38:14 PM
Source File: /Wisej.AspNetHost.aspx?sid=9d07c4e5-dd65-11b6-c2d4-274ca9ff7547&_cid=id_490&_sc=10
System.ArgumentNullException
Value cannot be null.
Parameter name: document
Stack Trace:
at DevExpress.DashboardCommon.Native.DashboardRestfulService.OnSpotDashboardFactory…ctor(XDocument document, IDataServiceConfigurator dataServiceConfigurator)
at DevExpress.DashboardWeb.Native.AdaptersFactory.c__DisplayClass5_0.b__0(XDocument dashboardXml)
at DevExpress.DashboardWeb.Native.RestrictedDataServiceAdapter.GetItemModelParams(String requestJson, Hashtable requestHashtable)
at DevExpress.DashboardWeb.Native.RestrictedDataServiceAdapter.GetMapShapeFileCore(String requestJson, Hashtable requestHashtable)
at DevExpress.DashboardWeb.Native.RestrictedDataServiceAdapter.GetMapShapeFile(IDictionary2 queryParams) at DevExpress.DashboardWeb.Native.ActionExecutor.Execute(String actionPath, String method, NameValueCollection queryValues, Func1 getRequestBody)
at DevExpress.DashboardWeb.ASPxDashboard.RaiseCallbackEvent(String eventArgument)
at DevExpress.Web.ASPxWebControl.System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent(String eventArgument)

So, I am trying to find a way to workaround that, and one of the ideas was to supply the map programmatically and for that, I found the link I originally showed in my original post, which has the following advice, from Constant, the support technician:

Your code is mostly correct. You only need to use the ChoroplethMapDashboardItem type to configure the item.

protected override XDocument LoadDashboard(string dashboardID) {  
    var dashDoc = base.LoadDashboard(dashboardID);  
    Dashboard d = new Dashboard();  
    d.LoadFromXDocument(dashDoc);  
    foreach( var mapItem in d.Items.OfType()) {  
        if(mapItem.CustomShapefile.Url != null) {  
            mapItem.CustomShapefile.Url = @"c:\Work\Projects\Work Projects\ASPCoreDashboard_Framework\ASPCoreDashboard_Framework\App_Data\WorldCountries.shp";  
        }  
    }  
    return d.SaveToXDocument();  
}  

This is why I was asking how I could override a method, in this case, the LoadDashboard method. Looking at our DevEx wrapper, I didn’t find a way on how to do it, because I simply don’t know. 🙂
I have attached a picture for you to have an idea. You see the error in an item on the left of a map, so, this item is an identical map which you see on the right. It worked in one, and not in the other. This is not the rule, sometimes the one on the left shows up, the other doesn’t. Sometimes none shows up. Sometimes both show just fine.

Anyway, my main issue is with the error stating the document is null by the time the Dashboard is showing the map. It is intermittent and sometimes shows them all fine, but some doesn’t.
If you could help me find out why this happens, it would be even better.
By the way, I have had a collateral effect from this error, which is that apparently I loose the reference to Wisej, and this is explained in the following post, which is still an issue which I haven’t been able to fix:

https://wisej.com/support/question/uncaught-referenceerror-wisej-is-not-defined

Sorry for the lengthy answer, but I have a feeling that something is getting lost in the AspNetControl and I just don’t know how to debug it.

Hopefully you will have an idea of what we could try.

Cheers.

Ivan

Attachment
  • You must to post comments
0
0

Hi Ivan,

You can find a sample that overrides IEditableDashboardStorage here: https://github.com/DevExpress-Examples/aspxdashboard-how-to-load-and-save-dashboards-from-to-a-database-t386418/blob/60da85f6c76f65c2bf5668d3a6d51d06532112ff/CS/DataBaseEditaleDashboardStorage.cs

 

You can apply this to your dashboard by doing something like:  this.dashboard1.SetDashboardStorage(new DataBaseEditaleDashboardStorage(“MyConnectionString”));

 

I’m not exactly sure what you’re trying to accomplish, but this should set you in the right direction for overriding the class!

HTH,

Levie

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.