Search This Blog

Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Friday, June 1, 2018

Concurrent Record Updates Merging in XPO-based XAF ASP.NET apps (v18.1)

From the Optimistic Concurrency Control help topic:
"In multi-user data-aware applications, there are times when one user edits a record while another user is editing the same record. As long as the changes being made do not affect the same field (e.g., one user modifies the task description while another user attaches a file), XAF applications can resolve the situation, and merge simultaneous changes made by different users. To enable field-level locking, set the XpoDefault.TrackPropertiesModifications static property to true."

Previously, this feature was available only for WinForms apps. With v18.1, ASP.NET WebForms XAF applications can handle concurrent record updates by merging simultaneous changes (by two or more different users) as well:


Here is also a video from our MainDemo.Web app (run from the Demo Center):



Notice that two different users can edit different properties (e.g., NickName and SpouseName) and then merge  these non-conflicting changes.

Have you already enabled this feature in your XAF Web apps? Please let us know how this works for you.

How to access and manipulate a custom ASP.NET user control from a Controller in a Module project


We have updated our How to: Show a Custom Data-Bound Control in an XAF View (ASP.NET) tutorial with more information on how to pass external data to custom Web user controls

Previously, our customers had the following difficulties with this task:

- In which project to create web user controls. By default, ASP.NET suggests doing this in the YourSolution.Web project. Adding an *.ASCX control into the YourSolutionName.Module.Web project led to errors.

- How to deal with circular references when attempting to reference the YourSolution.Web project from a Controller defined in the YourSolutionName.Module.Web project.
- How to pass an IObjectSpace, XafApplication or current View object to a custom user control.


A common way to resolve such a dependency (unrelated to XAF itself) is to define an interface within your class library (a XAF module project) and implement it by using your custom user control.


Friday, May 25, 2018

Web - How to avoid issues with data-bound controls due to missing or non-unique key values

Check out the Web - How to avoid issues with data-bound controls due to missing or non-unique key values KB article to make sure that your business model is aligned with the best practices. Here is a short extract:


Symptoms
You may notice the following side-effects in a Web ListView while it may work fine in WinForms:
- A wrong DetailView may be selected when an unsaved record is clicked in ListView;
- ListView may have no selection column;
- In inline edit or batch mode, all records may become selected or editable.
These effects are especially frequent in a non-persistent class ListView or a nested ListView for an aggregated details collection with newly added or unsaved records.

Explanation
All new records added to the ListView and not yet saved to the database will be assigned with a temporary key value (e.g. -1 or an empty Guid/String value depending on your key type). In a Web application, ListView uses a business class key property to identify records, because there is no way to access real business objects from the web browser. Hence, there is a requirement that each business object must have a unique value assigned to the key property. ASPxGridView and other data-bound controls require this for the correct operation of such features like selection, filtering, sorting, grouping and the standard XAF functionality that depends on them (see also ASPxGridBase > KeyFieldName). 
If a key property is missing in a business class completely or if a key property is not initialized with a unique value immediately after the record is created, these duplicate or invalid records may lead to a data-bound control malfunction as expected.


Please inform me of your health-check results!

FreeImages.Com

Thursday, February 8, 2018

Beware of the failures when uploading JPEG/JPG images using the System.Drawing.Image type properties - XAF ASP.NET WebForms v17.2.5

 issue, which is already fixed in XAF v17.2.6

We apologize for the inconvenience, and if you cannot wait for the hotfix or did not plan to spend additional time on upgrade right now, please consider using the workarounds.

Important notes and workarounds
From v14.2, Image Property Editors (both WinForms and ASP.NET) support images saved as byte array objects (in addition to previously supported System.Drawing.Image objects). This allows us to significantly decrease web server memory consumption because the byte array can contain an image in a compressed format and the server does not have to unpack it. The previous approach with the System.Drawing.Image type property is still supported, but we recommend that you migrate to the byte array storage to improve performance. Refer to the BLOB Image Properties in XPO  and How to change the image property type from System.Drawing.Image to byte array help topics for more details. 



Wednesday, December 6, 2017

How to use the ASPxSpreadsheet control as a property editor in an XAF ASP.NET WebForms application


If you want to display a business object that has a byte array property as an Excel document allowing users to modify the content and save it to the database, ASPxSpreadsheet is an appropriate component for this task. Our new example shows how to implement an XAF Web Property Editor based on this control:


If this is something you have already implemented or planned, we would greatly appreciate it if you describe your use-case scenarios or exactly how and for what your end-users are supposed to use spreadsheet control in your app. If possible, attach screenshots, test samples and database to clarify expected results and user steps within the application UI as well as already implemented solutions for this task. With that, we will be able to better understand your requirements and provide more specific solutions or consider improvements to our products for the future. Thanks in advance.

FreeImages.com/Jason Young

Monday, November 6, 2017

ASPxGridListEditor - How to customize the column chooser of the Web ListView's grid control

I wanted to promote the article that shows how to  increase the ASPxGridView's customization window size, because last week there were two requests for this + I searched around a dozen tickets in both XAF and ASPxGridView knowledge bases on the same subject. 



Previously, it was possible for developers to hard code the required width and height for this window.
Around v17.1, the ASPxGridView team created the AllowResize option (based on feedback from XAF users mostly) so that end-users could resize this dialog as they wish at runtime.

Currently, the AllowResize option is set to False by default, because the ASPxGridView team is afraid of breaking existing customer projects.

EDIT: The ASPxGridView has implemented AllowResize = True in v17.2 RTM by default.

I am looking forward to hearing from you on whether you or your end-users ever had problems with this so that our both teams can take this into account regarding future product updates. Thanks.

Thursday, September 7, 2017

Minor improvements to the Web editors for image and reference properties

Starting with version 17.1.6, we simplified access to the internal upload control of the ASPxImagePropertyEditor, because several users wanted to tweak it. Here is the KB Article showing how to access ASPxImagePropertyEditor's ASPxUploadControl and customize it to set the maximum file size and allowed file extensions for the uploaded images:






Starting with version 17.1.6, we added the static DefaultViewModeBehavior property and the ViewModeBehavior property to the ASPxObjectPropertyEditorBase class (the base class for ASPxLookupPropertyEditor and ASPxObjectPropertyEditor used for reference properties).

To globally disable or show links, we recommend using the static ASPxObjectPropertyEditorBase.DefaultViewModeBehavior property instead of the former ASPxObjectPropertyEditorBase.ShowLink property. For instance, you can do this in the YourSolutionName.Web/Global.asax.xx or WebApplication.xx files:

static MainDemoWebApplication() {
            DevExpress.ExpressApp.Web.Editors.ASPx.ASPxObjectPropertyEditorBase.DefaultViewModeBehavior 
                = DevExpress.ExpressApp.Web.Editors.ASPx.ObjectPropertyEditorViewModeBehavior.ShowLabel;

If it is necessary to disable or show links in a specific situation, you no longer need to inherit a custom property editor from ASPxLookupPropertyEditor; just get access to the required PropertyEditor (see Access Editor Settings) and set the ViewModeBehavior property to the ShowLabel or ShowLink value. 


Thursday, June 22, 2017

How to display another web site or custom HTML inside IFRAME embedded into an XAF View

I would like to share links to the solutions for ASP.NET WebForms apps allowing you to display arbitrary HTML content in XAF Views. For instance, one may want to use it to display HTML emails in a DetailView or load a complete third-party web site. Take special note that these custom solutions are NOT based on the built-in HTML Property Editor Module and its ASPxHtmlPropertyEditor that uses the DevExpress ASPxHtmlEditor control.

The T178588 ticket describes a very basic solution for displaying a static URL within a DetailView.
The T180499  ticket provides a more complex solution where HTML content is loaded dynamically from a business class property.



Both solutions are based on a very popular way to integrate custom controls in XAF - custom View Items. A custom ViewItem is often preferred over a custom PropertyEditor when you just need to display data without editing and other capabilities. Of course, you can choose from more integration options based on your exact business requirements: Concepts > UI Construction > Using a Custom Control that is not Integrated by Default.

It would be great to hear about whether you experienced similar scenarios and which solutions you are using for them in your Web app. Please let me know in comments to this post. Thanks.

P.S.
While we are at it, it is worth noting that we do not support displaying an XAF Web app inside an IFRAME element by default.

Wednesday, May 31, 2017

XAF ASP.NET WebForms - Beware of the FormatException (Input string was not in a correct format) when clicking a record in a popup ListView

I want to draw your attention to the T514321: ASPxGridListEditor - FormatException is thrown when selecting an object in a lookup ListView shown from an aggregated collection issue, which is already fixed in XAF for v16.2.7/17.1.4

If you came across a similar issue (check the call stack), the highlighted thread contains the hotfix installation for v17.1.


Tip:
When you experienced an exception in DevExpress code, I recommend you locate its callstack and search for one or several topmost method names in our support database, because this behavior might be reported by someone else: https://search.devexpress.com/?q=ASPxGridViewContextMenu.SelectObject&m=SupportCenter


In addition, I recommend checking the Known Issues sections in our What's New documentation:

Thursday, May 25, 2017

Improved ASPxGridListEditor performance when selecting records in the grid control


Starting with version 16.2.7, we improved the selection behavior of ASPxGridListEditor. Currently, ASPxGridView does not re-render itself when selection is changed. 

See screenshots of the Network tab in Chrome Developer Tools (F12) that demonstrates how the size and time of a response in the Opportunity_ListView of the XCRM demo is reduced. The size and time of a response is reduced about 4 times and 35% respectively.

v16.2.7, 17.1.3+












v16.2.6 and lower



Tuesday, May 23, 2017

Web - How to preserve the FullTextSearch Action filter after opening details for a record and returning back to ListView

I want to repost an interesting ASP.NET WebForms scenario and a solution for it I provided to a customer yesterday. Watch this video to see how this works:



If you are interested in having something like this, check out this Support Center thread for a relatively simple Controller.

Tuesday, May 9, 2017

XAF ASP.NET WebForms v16.2 - Beware of the ArgumentException (An item with the same key has already been added) in Web Dashboards

I want to draw your attention to the T511396: Web Dashboards - ArgumentException - An item with the same key has already been added issue, which is already fixed in XAF for v16.2.7
This error can occur if the application model contains different BO Models with the same Caption and is visible in dashboards.

If you came across a similar issue (check the call stack), the highlighted thread contains a simple temporary solution (make captions different or remove the VisibleInDashboardsAttribute from classes that are not required in dashboards)  + hotfix installation.



Friday, April 21, 2017

Documentation updates with regard to ways to resize windows in XAF

We have recently updated our online documentation in this regard, so you may be interested to check it out:
    Task-Based Help > How to: Adjust the Size and Style of Pop-up Dialogs (WinForms)
    Task-Based Help > How to: Adjust the Size and Style of Pop-up Dialogs (ASP.NET)

Attentive readers could notice that the PopupWindowShowAction.CustomizePopupWindowParams event arguments now provide the new Size and Maximized properties that can be used to specify the popup window size from a platform-agnostic module in certain cases (check the end of both articles above for more details on the limitations).

Of course, these code solutions can be further improved based on your business requirements. For instance, if you want to provide a developer or application user with the capability to specify sizes in the Model Editor, you can extend required View node types (e.g., IModelView) with the Width and Height attributes in the Application Model and then modify the aforementioned code to read these attributes respectively. Refer to the eXpressApp Framework > Concepts > Application Model > Extend and Customize the Application Model in Code article for more details.


Please tell me about your experience with these solutions or about anything you would love to improve in this regard. Thanks in advance.

FreeImages.com/Carolina Rodríguez

Wednesday, April 19, 2017

ASPxColorPickerPropertyEditor - New ASPxColorEdit-based editor for color properties


With XAF v17.1, you can consider using the new DevExpress.ExpressApp.Web.Editors.ASPx.ASPxColorPickerPropertyEditor class for representing color properties. It is enabled by default only in newly created XAF v17.1+ projects (existing projects will continue using the previous ASPxColorPropertyEditor). 






This is a small feature, but it is still worth mentioning here because we received several user requests for it. Finally, we wanted to go away from the custom tailored editor we used (it was created many years ago before ASPxColorEdit) and this was a good task for a junior developer☺.

What about you? Are you using this editor in your apps? If so, please tell us more about your typical uses.

Tuesday, April 11, 2017

Web Layout Manager improvements and important changes in XAF v17.1

In the 17.1 version, we have improved the scenario of loading the ASPxPageControl tab content when XafApplication.DelayedViewItemsInitialization equals True and the Conditional Appearance module is involved. So, if you encountered missing or not fully loaded tab contents in this configuration, and had to previously adjust the application-level DelayedViewItemsInitialization or View-level DelayedItemsInitialization options to avoid this behavior (learn more...), starting with v17.1, it is possible to revert these options to True by default. 

Take special note that these improvements required us to introduce some changes, which may affect a very small group of users who created and registered custom layout group templates in WebLayoutManager. Frankly speaking, this was needed for very advanced scenarios (we could locate only a few cases in our large Support Center database), so we expect that the majority of XAF users will not be affected by these changes. Anyway, if you feel or know that you could have been affected, refer to the Web Layout Manager improvements and important changes in XAF v17.1 KB Article for more details.


BTW, have you ever created custom layout item and group templates for WebLayoutManager?:-) If so, please share your use-cases in comments. I am asking because it is quite possible that we already have better solutions for you (e.g., expandable/collapsible layout groups are already supported out-of-the-box)!

Tuesday, March 14, 2017

XAF app performance: Reducing the number of simultaneous database connections



Multiple simultaneously opened connections consume your database server memory and thus, have negative impact on your application performance. To diagnose this situation, you can use the following SQL script:

SELECT 
    DB_NAME(dbid) as DBName, 
    COUNT(dbid) as NumberOfConnections,
    loginame as LoginName
FROM
    sys.sysprocesses
WHERE 
    dbid > 0
GROUP BY 
    dbid, loginame

Thankfully, there is a couple of tricks to optimize your existing apps in production (they are already applied out of the box in new projects).


Friday, March 10, 2017

XAF ASP.NET WebForms v16.2.5 - Beware of the missing Edit Action after navigating to dashboard items


I want to draw your attention to the T490025: WebEditDashboardController hides the Edit Action of ListViewController and doesn't reactivate it issue, which is already fixed in XAF for v16.2.6. This thread contains a simple temporary solution if you came across a similar use scenario (hotfix installation will be available later).



Wednesday, March 8, 2017

Preview of toast notifications using a platform-agnostic method in XAF v16.2.5 - YOUR FEEDBACK IS NEEDED!!!

I am still forcing myself to go to sleep after watching an unreal football drama in Barcelona, so I am writing this short blog post at night.
Besides Visual Studio 2017 official support, XAF v16.2.5 delivers a small gem, which I cannot hide from you too long. Remember that this is an early preview of the functionality we hope to officially release by v17.1 and which is have polished in the coming 2-3 months. So, your feedback is welcome, as always!

Typical usage

Let's modify the platform-agnostic Controller from our demo (C:\Users\Public\Documents\DevExpress Demos 16.2\Components\eXpressApp Framework\SimpleProjectManager\CS\SimpleProjectManager.Module\Controllers\ProjectTaskController.cs) by adding the Application.ShowViewStrategy.ShowMessage call at the end of the Execute event handler:
...
            markCompletedAction.Execute += (s, e) => {
                IObjectSpace viewDataContext = View.ObjectSpace;
                foreach(ProjectTask task in e.SelectedObjects) {
                    task.EndDate = DateTime.Now;
                    task.Status = ProjectTaskStatus.Completed;
                    viewDataContext.SetModified(task); // Mark the changed object as 'dirty' (only required if data properties do not provide change notifications).
                }
                viewDataContext.CommitChanges();
                //viewDataContext.Refresh(); // Optionally update the UI in accordance with the latest data changes.
                Application.ShowViewStrategy.ShowMessage(string.Format("{0} task(s) have been completed!", e.SelectedObjects.Count), InformationType.Success, 4000, InformationPosition.Top);
            };
...
Now, let's start the Windows and Web apps, select a few uncompleted tasks in the ProjectTask ListView and execute the Done! command from the menu.

Result in the UI for various platforms

Web
A nice notification window is managed using the dxToast widget (invoked via the  DevExpress.ui.notify method) from our DevExtreme HTML5/JavaScript library:



Thursday, March 2, 2017

Opening a navigation item in a separate web browser tab (shipping in v16.2.5)

This is another follow-up on the EnableMultipleBrowserTabsSupport feature after receiving great user feedback in this blog and via other channels (see my previous post in this regard for more details).

With the recently released XAF v16.2.5, you can open a View in a separate browser tab directly from navigation. To enable this mode, set the static NavigationActionContainer.UseLinks static property in the YourSolutionName.Web/Global.asax.xx file:

        protected void Application_Start(object sender, EventArgs e) {
            WebApplication.EnableMultipleBrowserTabsSupport = true;
            DevExpress.ExpressApp.Web.Templates.ActionContainers.NavigationActionContainer.UseLinks = true;


When this mode is enabled, an Anchor element is added into nodes of the ASPxTreeView control and into items of the ASPxNavBar control. 
This feature allows you to use generic browser techniques to work with links such as a right mouse button click for context a menu, a Control key press or a mouse wheel click (currently, the approach described in the http://apple.stackexchange.com/questions/170731/how-to-open-link-in-a-new-tab-via-shortcut-in-chrome-on-mac article will not work for Macs).




ASPxGridView/ASPxGridListEditor + Server Mode + Select All = ?

I want to pay your attention to this Support Center ticket describing a recent fix for our ASPxGridListEditor, which is a wrapper over the ASPxGridView component as you know.

It is a known and pretty logical Server Mode limitation that the selection of ALL grid rows using the built-in SelectAll check box is NOT supported in this mode. That is because this particular operation defeats all server mode benefits = causes loading the whole data source into the web server memory...

Our ASPxGridListEditor did not manage the "Select All" header cell visibility prior to v16.2.4. We have corrected this mistake and now this button is hidden in server mode by default (SelectAllCheckboxMode = None). The "Select All" button is still available in Client and DataView modes only (SelectAllCheckboxMode = AllPages), though.


If you want, you can implement a custom Controller from the ticket to enable selection of all records on the currently active page only when DataAccessMode = Server (we did not follow this route in the XAF code, because it would be more confusing and even damaging for users who got used to this command). Alternatively, you can set DataAccessMode = Client/DataView  for a required ListView node using the Model Editor (of course, it you do not have many data records).


If these solutions do not help, please describe your real life use-case scenario where this SelectAll feature is needed when grid is operating in server mode. It is possible that we have an alternative and even better technical solution for you, e.g. like we did for Reinhold and his reporting scenario.