Google Map Property editor issue

StatusIDPriorityType
Closed23057BlockerQuestion
ProfileReply
Bikash NandiClient

Hi,

I am following your feedback for DC in the following ticket:
https://galaktikasoft.com/tickets/to-incorporate-google-map-in-our-xaf-app

Now, the following exception is raised.
Would you please provide demo project.

The error occurred:

Type: InvalidOperationException
Message: Exception occurs while assigning the 'DetailView, ID:IIClub_DetailView' view to WebWindow:
The 'Xafari.Base.GeoPoint' type is not persistent.
Data: 0 entries
Stack trace:

at DevExpress.ExpressApp.Frame.SetView(View view, Boolean updateControllers, Frame sourceFrame)
at DevExpress.ExpressApp.Web.WebApplication.ShowViewInMainWindow(View view, Frame frame)
at DevExpress.ExpressApp.Web.ShowViewStrategy.ShowViewByDefault(ShowViewParameters parameters, ShowViewSource showViewSource)
at DevExpress.ExpressApp.Web.ShowViewStrategy.ShowViewFromCommonView(ShowViewParameters parameters, ShowViewSource showViewSource)
at DevExpress.ExpressApp.ShowViewStrategyBase.ShowViewCore(ShowViewParameters parameters, ShowViewSource showViewSource)
at DevExpress.ExpressApp.ShowViewStrategyBase.ShowView(ShowViewParameters parameters, ShowViewSource showViewSource)
at DevExpress.ExpressApp.Frame.ProcessActionCreatedView(ActionBaseEventArgs e)
at DevExpress.ExpressApp.Web.WebWindow.ProcessActionCreatedView(ActionBaseEventArgs e)
at DevExpress.ExpressApp.Frame.ShowViewAction_ProcessCreatedView(Object sender, ActionBaseEventArgs e)
at DevExpress.ExpressApp.Actions.ActionBase.OnProcessCreatedView(ActionBaseEventArgs e)
at DevExpress.ExpressApp.Actions.ActionBase.ExecuteCore(Delegate handler, ActionBaseEventArgs eventArgs)
----------------
InnerException:

Type: ArgumentException
Message: The 'Xafari.Base.GeoPoint' type is not persistent.
Data: 0 entries
Stack trace:

at DevExpress.ExpressApp.CollectionSource..ctor(IObjectSpace objectSpace, ITypeInfo objectTypeInfo, CollectionSourceDataAccessMode dataAccessMode, Boolean isAsyncServerMode, CollectionSourceMode mode)
at DevExpress.ExpressApp.XafApplication.CreateCollectionSourceCore(IObjectSpace objectSpace, Type objectType, CollectionSourceDataAccessMode dataAccessMode, CollectionSourceMode mode)
at DevExpress.ExpressApp.XafApplication.CreateCollectionSource(IObjectSpace objectSpace, Type objectType, String listViewId, CollectionSourceDataAccessMode dataAccessMode, CollectionSourceMode mode)
at DevExpress.ExpressApp.XafApplication.CreateCollectionSource(IObjectSpace objectSpace, Type objectType, String listViewId, CollectionSourceMode mode)
at DevExpress.ExpressApp.Editors.LookupEditorHelper.CreateCollectionSourceCore(IObjectSpace objectSpace, Type lookupObjectType, String listViewID, CollectionSourceMode collectionSourceMode, Boolean strictlyClientMode)
at DevExpress.ExpressApp.Editors.LookupEditorHelper.CreateCollectionSourceCore(Object editingObject, Boolean strictlyClientMode)
at DevExpress.ExpressApp.Editors.LookupEditorHelper.CreateListView(Object editingObject)
at DevExpress.ExpressApp.Web.Editors.ASPx.ASPxLookupPropertyEditor.RecreateListView(Boolean ifNotCreatedOnly)
at DevExpress.ExpressApp.Web.Editors.ASPx.ASPxLookupPropertyEditor.UpdateDropDownLookupControlAddButton(ASPxLookupDropDownEdit control)
at DevExpress.ExpressApp.Web.Editors.ASPx.ASPxLookupPropertyEditor.UpdateDropDownLookup(ASPxLookupDropDownEdit editor)
at DevExpress.ExpressApp.Web.Editors.ASPx.ASPxLookupPropertyEditor.CreateDropDownLookupControl()
at DevExpress.ExpressApp.Web.Editors.ASPx.ASPxLookupPropertyEditor.CreateEditModeControlCore()
at DevExpress.ExpressApp.Web.Editors.WebPropertyEditor.CreateControlCore()
at DevExpress.ExpressApp.Web.Editors.ASPx.ASPxPropertyEditor.CreateControlCore()
at DevExpress.ExpressApp.Editors.ViewItem.CreateControl()
at DevExpress.ExpressApp.Web.Layout.LayoutItemTemplate.CreateViewItemControl(ViewItem viewItem)
at DevExpress.ExpressApp.Web.Layout.LayoutItemTemplate.InstantiateInCore(LayoutItemTemplateContainerBase container)
at DevExpress.ExpressApp.Web.Layout.LayoutBaseTemplate.InstantiateContainer(LayoutItemTemplateContainerBase container)
at DevExpress.ExpressApp.Web.Layout.DelayedControlInstantiationStrategy.c__DisplayClass2.b__0(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at System.Web.UI.ControlCollection.Add(Control child)
at DevExpress.ExpressApp.Web.Controls.ViewSiteControl.view_ControlsCreated(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at DevExpress.ExpressApp.View.OnControlsCreated()
at DevExpress.ExpressApp.View.CreateControls()
at DevExpress.ExpressApp.Web.Controls.ViewSiteControl.SetView(View view)
at DevExpress.ExpressApp.Web.Templates.BaseXafPage.SetView(View view)
at DevExpress.ExpressApp.Frame.SetTemplateView(View view)
at DevExpress.ExpressApp.Web.WebWindow.SetTemplateView(View view)
at DevExpress.ExpressApp.Frame.SetView(View view, Boolean updateControllers, Frame sourceFrame)
InnerException is null

Replies

UserDescriptionPosted On
Sasha (Xafari Support)Agent

Hello,

I created a new project using Xafari Documentation and ticket To incorporate google map in our XAF app – Galaktikasoft for DC:

  • Add XafariModule and XafariEditorsModule to the Module Project.
    Add XafariWebModule and XafariEditorsWebModule to the ASP.NET Web Module Project.

 

  • (You can use GeoPoint in your DC-based application almost the same way as in a XPO-based app)
    Here is the sample domain component(DC) with GeoPoint:
    [DomainComponent] [DefaultClassOptions] public interface GeoPointDomainComponent
    {
    string Title { get; set; }
    [ValueConverter(typeof(GeoPointConverter))] GeoPoint Point { get; set; }
    }
    Here is the sample domain logic for the domain component:
    [DomainLogic(typeof(GeoPointDomainComponent))] public class DomainComponent1Logic {
    public static void AfterConstruction(GeoPointDomainComponent instance) {
    instance.Point = new GeoPoint();
    }
    }
    Also do not forget to register entity in the Setup method of the Module.
    XafTypesInfo.Instance.RegisterEntity("GeoPointDomainComponent", typeof(GeoPointDomainComponent));
    (ticket To incorporate google map in our XAF app – Galaktikasoft)

 

  • Add a new View Controller to the ASP.NET Web Module Project, name it GoogleMapsViewController,
    and modify the automatically generated file content as follows.
    public partial class GoogleMapsViewController : ViewController
    {
    private void CallbackManager_ScriptCreating(object sender, ScriptCreatingEventArgs e)
    {
    ((Page)Frame.Template).ClientScript.RegisterStartupScript(typeof(Page), "mapScript",
    "<script type=\"text/javascript\" src=\"http://maps.google.com/maps/api/js?sensor=false\"></script>");
    }

    private XafCallbackManager GetCallbackManager()
    {
    XafCallbackManager manager = null;
    if (Frame != null && Frame.Template != null)
    {
    var holder = Frame.Template as ICallbackManagerHolder;
    if (holder != null)
    manager = holder.CallbackManager;
    }
    return manager;
    }

    private void Frame_TemplateChanging(object sender, EventArgs e)
    {
    var callbackManager = GetCallbackManager();
    if (callbackManager != null)
    callbackManager.ScriptCreating -= CallbackManager_ScriptCreating;
    }

    private void Frame_TemplateChanged(object sender, EventArgs e)
    {
    var callbackManager = GetCallbackManager();
    if (callbackManager != null)
    callbackManager.ScriptCreating += CallbackManager_ScriptCreating;
    }

    protected override void OnFrameAssigned()
    {
    base.OnFrameAssigned();
    Frame.TemplateChanging += Frame_TemplateChanging;
    Frame.TemplateChanged += Frame_TemplateChanged;
    }
    }
    The controller provides the java script required for the Google map. (Xafari Documentation)

 

  • Run the ASP.NET application. Select the ClassWithGeoPoint item in the navigation control and click New Action.
    In the invoked Detail View, you can see GoogleMapPropertyEditor.

 

Attached demo project:Ticket_23057 (Xafari v 14.2.507.114)

 

Please inform us of your result.

 

You can send us a simple sample where this issue is reproducible, if this solution not suits for you.

 

Feel free to contact us if you have any question.

Regards, Sasha.

Attached files:
Bikash Nandi

Hi,

I have created a sample according your instruction by using XAF 14.2.4 & Xafari 14.2.407.114
but it isnot working.
Am I missing anything?

Attached files:
Sasha (Xafari Support)Agent

Hello Bikash,
Thank you for the additional information.
You forgot to add XafariModule, XafariWebModule, XafariEditorsModule and XafariEditorsWebModule in your project.

 

to add XafariWebModule and XafariEditorsWebModule:
WebModule

 

to add XafariModule and XafariEditorsModule:
Module

I hope you find this information helpful.

 

We will be happy to help you.

Regards, Sasha.

Bikash Nandi

Hello Sasha,

Thanks for your guidance.

Now It is working properly in Fist time during saving as follows (step1.png)

But in View, Map isnot shown (view.png) and in Edit mode, empty map is shown(Edit.png).

and Sometimes, Javascript exception is raised(error1.png).

Kind Regards,
Bikash

Sasha (Xafari Support)Agent

Hello Bikash,

 

I have reproduced the problem demonstrated in your sample and forwarded your ticket to our developers for further research.

It will take some additional time.

 

Let me know if you need further assistance.

Thanks, Sasha.

 

 

 

Bikash Nandi

Hi Sasha,

Thanks.

In Addition, I need to show multiple locations (list data/selected data) in a single map. How can I achieve it?

In my sample I used GeoPoint as persistent property but I need to use GeoPoint as Calculated propety like:

Kind Regards,
Bikash

Sasha (Xafari Support)Agent

Hi Bikash,

 

Xafari Framework supports only current behavior for GeoPoint and you can't use GeoPoint as Calculated property (unfortunately, we are not planning to create this function in the near future).

But you can create own PropertiEditor or ListEditor for GeoPoint.

 

I hope you find this information helpful.

 

You're welcom.
Regards, Sasha.

Sasha (Xafari Support)Agent

Hi Bikash,

 

According to your problems:

  • "Now It is working properly in Fist time during saving as follows (step1.png)
    But in View, Map isnot shown (view.png) and in Edit mode, empty map is shown(Edit.png).
    and Sometimes, Javascript exception is raised(error1.png)."

 

We examined these issues:

 

1. Map is shown in View Mode. New Xafari assembly contains this functional.

 

2. We haven't reproduced the case when empty map is shown in Edit mode. See attached screenshot ViewMap.jpg.

If you can reproduce this problem, please, send us the example.

 

3. We haven't localized error with JavaScript yet.

But we have found out that it occur only in InternetExplorer, when you start application from visual studio.

If you deploy application, it works fine. You can use another browser to pass this problem.

The error similar to this described here:
http://forums.asp.net/t/1988487.aspx?Google+Maps+API+v3+when+scrolling+resizing+IE11+window+javascript+error+reported

 

Feel free to contact us if you have any question.
Regards, Sasha.

Attached files:

× This ticket is closed.

Write US