Ticket T589174
Visible to All Users

Nested ListView KeyProperty 'wrong'

created 7 years ago

Hello dear supporters,

I have a problem that allways at the first try in a Webapplication the Keyproperty-Value of an nested Listview is not correctly delivered by the 'ASPXGridView' which is behind and I get an ArgumentException…

Is there any 'model' setting which i have not done?

Code
The error occurred: Type: ArgumentException Message: Cannot convert the 'WPS5.Module.BusinessObjects.Schweisser(493)' value to the type of the 'WPS5.Module.BusinessObjects.Schweisser' key property type, error: Die Eingabezeichenfolge hat das falsche Format. Data: 0 entries Stack trace: bei DevExpress.ExpressApp.Xpo.XPObjectSpace.GetObjectKey(Type objectType, String objectKeyString) bei DevExpress.ExpressApp.Web.Editors.ASPx.ASPxGridViewContextMenu.SelectObject(String objectId) bei DevExpress.ExpressApp.Web.Editors.ASPx.ASPxGridViewContextMenu.ProcessCommand(String args) bei DevExpress.ExpressApp.Web.Editors.ASPx.ASPxGridViewContextMenu.DevExpress.ExpressApp.Web.Templates.IXafCallbackHandler.ProcessAction(String parameter) bei DevExpress.ExpressApp.Web.Templates.XafCallbackManager.ProcessAction(String parameter) bei DevExpress.ExpressApp.Web.Templates.XafCallbackManager.callbackControl_Callback(Object source, CallbackEventArgs e) bei DevExpress.Web.ASPxCallback.OnCallback(CallbackEventArgs e) bei DevExpress.Web.ASPxCallback.RaiseCallbackEvent(String eventArgument) bei DevExpress.Web.ASPxWebControl.System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent(String eventArgument) InnerException is null

Can anyone give me a hint, why that happens.
And why it only happens at the first 'time'. When I press 'back' in the exceptionhandling message and do the 'Action' again, all works perfectly well.

Thank you
Thomas

Show previous comments (6)
DevExpress Support Team 7 years ago

    Thank you for uploading your project. We need some time to review it. We will respond once we have any result.

    TV TV
    Thomas Vetterling 7 years ago

      I will upload a short video with the problem.
      Thank you.

      DevExpress Support Team 7 years ago

        Thank you for the additional information. I replicated the issue. We need some additional time to research it. I will get back once we have any results.

        Answers approved by DevExpress Support

        created 7 years ago (modified 7 years ago)

        Hello, Thomas.

        UPDATED:
        We researched the issue and found that the optimized processing of the default list view action is broken by a syntax error in the script produced by your WebGridLookupPropertyEditor implementation. In the WebGridLookupPropertyEditor.AddClientSideEvents method, you are using the following code:

        C#
        ((WebApplication)application).PopupWindowManager.GetShowPopupWindowScript(newObjectWindowAction,GetNewObjectAddedCallbackScript(control),control.ClientID,false,true)

        The GetNewObjectAddedCallbackScript method creates a script that is inserted into the outer script without escaping single quotation marks.
        You can fix the script error and the original issue as follows:

        C#
        string cbscript = GetNewObjectAddedCallbackScript(control).Replace("'", "\\'"); string subscript = ((WebApplication)application).PopupWindowManager.GetShowPopupWindowScript(newObjectWindowAction, cbscript, control.ClientID, false, true);

        I also recommend that you use the DevExpress.ExpressApp.Web.Utils.ClientSideEventsHelper.AssignClientHandlerSafe method to attach client side event handlers that do not overwrite scripts attached by the XAF framework.

        See also:
        Faster rendering and other performance optimizations for popular Web UI scenarios in XAF v16.1

          Comments (2)
          TV TV
          Thomas Vetterling 7 years ago

            Thank you for your hints.
            Now it works as expected.
            But I wonder why i have to use
            DevExpress.ExpressApp.Web.WebApplication.OptimizationSettings.AllowFastProcessListViewRecordActions = false;as that is decreasing Performance.

            Is there any way how I can use 'custom' client event handler without settion the above property to true?

            Yours Thomas

            DevExpress Support Team 7 years ago

              We researched the issue further and found that the optimized processing of the default list view action is broken by a syntax error in the script produced by your WebGridLookupPropertyEditor implementation. In the WebGridLookupPropertyEditor.AddClientSideEvents method, you are using the following code:

              C#
              ((WebApplication)application).PopupWindowManager.GetShowPopupWindowScript(newObjectWindowAction,GetNewObjectAddedCallbackScript(control),control.ClientID,false,true)

              The GetNewObjectAddedCallbackScript method creates a script that is inserted into the outer script without escaping single quotation marks.
              You can fix the script error and the original issue as follows:

              C#
              string cbscript = GetNewObjectAddedCallbackScript(control).Replace("'", "\\'"); string subscript = ((WebApplication)application).PopupWindowManager.GetShowPopupWindowScript(newObjectWindowAction, cbscript, control.ClientID, false, true);

              I have updated my answer.

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.