Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all 7205 articles
Browse latest View live

How to use the ASPxWebControl.CallbackError event to handle application-level errors occurred inside ASPxWebControls during callback processing

$
0
0

This example illustrates how to catch and handle:
- Exceptions that occur inside DevExpress ASP.NET controls during a callback using the ASPxWebControl.CallbackError event;
- The remaining unhandled exceptions using the Application_Error event in the Global.asax file.
It also shows how to write required information to the same log/storage (for further diagnostics, etc).


Global.asax:

[C#]
voidApplication_Start(objectsender,EventArgse){// Assign Application_Error as a callback error handlerASPxWebControl.CallbackError+=newEventHandler(Application_Error);}

 

[VB.NET]
Sub Application_Start(ByVal sender AsObject, ByVal e As EventArgs)' Assign Application_Error as a callback error handlerAddHandler ASPxWebControl.CallbackError, AddressOf Application_ErrorEndSub

 

[C#]
voidApplication_Error(objectsender,EventArgse){// Use HttpContext.Current to get a Web request processing helperExceptionexception=HttpContext.Current.Server.GetLastError();if(exceptionisHttpUnhandledException)exception=exception.InnerException;// Log an exceptionAddToLog(exception.Message,exception.StackTrace);}

 

[VB.NET]
Sub Application_Error(ByVal sender AsObject, ByVal e As EventArgs)' Use HttpContext.Current to get a Web request processing helperDim exception As Exception = HttpContext.Current.Server.GetLastError()If TypeOf exception Is HttpUnhandledException Then exception = exception.InnerExceptionEndIf' Log an exception AddToLog(exception.Message, exception.StackTrace)EndSub


By default, an unhandled exception occurs while a callback is displayed using the "alert" message.
In order to execute redirect to a custom error page, specify the callbackErrorRedirectUrl configuration option:

Web.config:

[XML]
<configuration><devExpress><errorscallbackErrorRedirectUrl="~/ErrorPage.aspx"/></devExpress></configuration>



MVC Version:
How to use the ASPxWebControl.CallbackError event to handle application-level errors occurred inside ASPxWebControls during callback processing

Question Comments

Added By: okan sarıca at: 7/13/2012 2:21:38 AM    

i handle the exception in global asax but how can i send message to callbackcontrol for example ? if i throw a new exception in global asax e.message in callbackError function is 'some error occured'

Added By: Eric Malgeri 1 at: 8/17/2017 8:53:27 AM    Hello,

I have tried to implement this sample code to my project where I am processing a lot of files within the
CallbackControl_Callback() method on the server.  This process can take a while and a timeout can occur.  When the timeout does occur, it appears that the error handling does redirect the application to the error page, but the memo box is empty.  This indicates that the Application_Error method was not invoked.  I have code in that method to display the exception message in the memo box on the error page.

How can timeout events be trapped and explicit error messages set or exceptions be caught when co de is executing in the 
CallbackControl_Callback() method where it should then be handled by the Application_Error() method contained in the Global.asax.cs file?  


How to create a master-detail report in a RichEditControl

ASPxGridView - How to apply Custom Function Filter Criteria Operator

$
0
0

Some complicated filter cases require visiting every leaf of the filter criteria tree when a custom function criteria operator is used. 
This example shows how it can be implemented via CriteriaPatchBase's class descendant.
The main idea is to operate with ASPxGridView's FilterExpression:
1. If FilterExpression has a custom function operator, it's necessary to find exactly this custom operator and replace its value with an actual one.
In the case of Auto Filter Row, this can be done in the ASPxGridView.ProcessColumnAutoFilter event handler as shown below:

[C#]
protectedvoidGrid_ProcessColumnAutoFilter(objectsender,DevExpress.Web.ASPxGridViewAutoFilterEventArgse){vargrid=(ASPxGridView)sender;if(e.Column.FieldName==SpecialFilterColumnFieldName&&e.Kind==GridViewAutoFilterEventKind.CreateCriteria){grid.FilterExpression=UpdateGridFilterExpression(grid,e);e.Criteria=null;}}

Note that e.Criteria in this case must be set to null.

2. Then, assign the custom criteria operator value to the filter editor.
The right place of the code to do this is the ASPxGridView.AutoFilterCellEditorInitialize event handler. For example, it can be implemented in the following manner:

[C#]
protectedvoidGrid_AutoFilterCellEditorInitialize(objectsender,ASPxGridViewEditorEventArgse){vargrid=(ASPxGridView)sender;if(e.Column.FieldName==SpecialFilterColumnFieldName){vargridCriteria=CriteriaOperator.Parse(grid.FilterExpression);e.Editor.Value=CriteriaVisitor.GetCustomFunctionOperatorValue(gridCriteria,e.Column.FieldName);}}

where CriteriaVisitor is CriteriaPatchBase's class descendant (see implementation details).   

See also: 
The base implementation of the IClientCriteriaVisitor interface for the CriteriaOperator expression patcher

ASPxGridView - Batch Edit mode - How to use the client-side FocusedCellChanging event and cancel editing or disable an editor conditionally

$
0
0
Starting from version 17.1 we have introduced a new client-side FocusedCellChanging event. This event allows you to skip focusing and editing a cell.
This example demonstrates different ways to skip or prevent editing certain cells.

ASPxGridView - How to create Accent Insensitive filter

$
0
0
This example demonstrates how to create a custom function criteria operator that removes all diacritic symbols from the specified string value. 
Using the CriteriaPatchBase's class descendant expand filtering capabilities and play more complicated scenarios. The simple implementation of this class (CriteriaVisitor) is presented in this example.
The ASPxGridView.SubstituteFilter event handler is used to apply accent insensitive filter.

HOW TO APPLY:
1. Add all 3 files from the App_Code folder: CriteriaPatcherBase.cs, CriteriaVisitor.cs, RemoveDiacriticsFunction.cs;
2. Register the custom function criteria operator when the Page's Init event is raised in the following manner:
[C#]
CriteriaOperator.RegisterCustomFunction(newRemoveDiacriticsFunction());
 3. Substitute ASPxGridView's filter in the ASPxGridView.SubstituteFilter event handler as follows:
[C#]
protectedvoidGrid_SubstituteFilter(objectsender,DevExpress.Data.SubstituteFilterEventArgse){e.Filter=CriteriaVisitor.Substitute(e.Filter);}


See also:
ASPxGridView - How to apply Custom Function Filter Criteria Operator
The base implementation of the IClientCriteriaVisitor interface for the CriteriaOperator expression patcher

ASPxRichEdit - How to change the Mail Merge data sources at runtime

$
0
0

This example illustrates how to switch data sources used for Mail Merge in ASPxRichEdit at runtime.

To update ASPxRichEdit's data source dynamically, wrap it in the ASPxCallbackPanel control and use its callbacks to refresh data.
Note that ASPxRichEdit should be bound to actual data on every round-trip to the server, so it is insufficient to set the data source in the server-side Callback event handler only. It's necessary to restore the actual data source and bind ASPxRichEdit to it on each request in the Page_Init event handler.
In addition, it is necessary to clear the current document in ASPxRichEdit each time the data source is changed. For this purpose, you can use the server-side ASPxRichEdit.New method.

GridView - How to focus a newly inserted row

$
0
0

This example demonstrates how to focus a newly added row.

Question Comments

Added By: Zoltán Juhász at: 12/1/2015 3:44:05 AM    

The example does not work with DevExpress 15.1.7. After set FocusedRowIndex property value still remain -1.

Added By: Larry (DevExpress Support) at: 12/1/2015 4:55:45 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T319045: The E4787 example works incorrectly in version 15.1. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to create a master-detail report in a RichEditControl


How to drop an appointment from an external control onto an ASPxScheduler

$
0
0

This example illustrates how to drag and drop an item from an external control (ASPxGridView in this example) to the ASPxScheduler area in order to create an appointment. Note that this example is an extended version of the ASPxScheduler - How to drag a row from ASPxGridView and create an appointment based on its values code example. The advantage of this project is that an appointment is created in a time cell to which a corresponding grid item is dropped, whereas in the previous example, the appointment time is taken from a grid row. 

To obtain the current/active time cell, we use non-documented CalcHitTest and initializeCell client-side methods.Please note that these method implementations can be changed in future versions of the control. Contact us if you use these methods in your project and face any issues while upgrading your project to a newer version. We will provide you with instructions on how to replace or customize these methods.

Here is a screenshot that illustrates a sample application in action during the custom drag-and-drop operation:


See Also:

How to drop an appointment from ASPxScheduler to an external control

How to set GridColumn’s relative width

$
0
0

Currently, relative width is not supported in the GridControl out of the box. However, to achieve this functionality, the BandedViewBehavior can be used. Define columns in the BandedViewBehavior.ColumnDefinitions collection and use the BandedViewBehavior.Column attached property to specify a column.

Question Comments

Added By: Plotkin Michael at: 8/21/2017 11:28:00 AM    Hi,

Got

System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection.'


in   DevExpress.Xpf.Grid.v17.1.Extensions.dll!DevExpress.Xpf.Grid.ResizableGrid.Resize(DevExpress.Xpf.Grid.ColumnBase gridColumn, double diff) 

on any column resize

How to use a Background Geolocation in XAF Mobile

$
0
0
This example demonstrates how to take advantage of a mobile device positioning system in your XAF mobile application using the Cordova Background Geolocation plugin and Cordova Device plugin . Additionally, you will learn how to access the PhoneGap config file (regular XML file) and add the plugin to your application.

Scenario:
You want to automatically track movements of an XAF mobile application user and display the user's route on the map, e.g., in a separate administrative XAF Web application:




Your feedback is needed!
This is not an official feature of our Mobile UI (CTP) and our API may change in future release cycles. We are publishing this article prior to the 17.2 release to collect early user feedback and improve overall functionality. We would appreciate your thoughts on this feature once you've had the opportunity to review it. Please report any issues, missing capabilities or suggestions in separate tickets in our Support Center. Thanks for your help in advance!

Prerequisites
Install any v17.1.5+ version.
The implementation steps below are given for a new application, though they can be applied to any other XAF mobile app.

Steps to implement
1. 
Create a new XAF solution with Web and Mobile platforms and enable the Maps Module in it. 

2. In the YourSoltutionName.Mobile/MobileApplication.xx file, handle the MobileApplication.CustomizePhoneGapConfig event to register the Cordova Background Geolocation plugin. The code snippet below demonstrates how to add required records to the PhoneGap configuration file (you can find this code in the BackgroundGeolocation.Mobile/MobileApplication.xx file of the sample project):
[C#]
privatevoidBackgroundGeolocationMobileApplication_CustomizePhoneGapConfig(objectsender,CustomizePhoneGapConfigEventArgse){XElementroot=e.PhoneGapConfig.Root;XNamespacephoneGapNamespace="http://phonegap.com/ns/1.0";XElementpluginElement=newXElement(phoneGapNamespace+"plugin",newXAttribute("name","cordova-background-geolocation-lt"),newXAttribute("source","npm"),newXAttribute("spec","2.7.3"));pluginElement.Add(newXElement("variable",newXAttribute("name","LOCATION_ALWAYS_USAGE_DESCRIPTION"),newXAttribute("value","Background location-tracking is required")));pluginElement.Add(newXElement("variable",newXAttribute("name","LOCATION_WHEN_IN_USE_USAGE_DESCRIPTION"),newXAttribute("value","Background location-tracking is required")));pluginElement.Add(newXElement("variable",newXAttribute("name","MOTION_USAGE_DESCRIPTION"),newXAttribute("value","Using the accelerometer increases battery-efficiency by intelligently toggling location-tracking only when the device is detected to be moving")));// pluginElement.Add(new XElement("variable", new XAttribute("name", "LICENSE"), new XAttribute("value", "YOUR_LICENSE_KEY")));root.Add(pluginElement);root.Add(newXElement(phoneGapNamespace+"plugin",newXAttribute("name","cordova-plugin-device"),newXAttribute("source","npm"),newXAttribute("spec","1.1.6")));}
[VB.NET]
PrivateSub BackgroundGeolocationMobileApplication_CustomizePhoneGapConfig(ByVal sender AsObject, ByVal e As CustomizePhoneGapConfigEventArgs)Dim root As XElement = e.PhoneGapConfig.RootDim phoneGapNamespace As XNamespace = "http://phonegap.com/ns/1.0"Dim pluginElement AsNew XElement(phoneGapNamespace + "plugin", New XAttribute("name", "cordova-background-geolocation-lt"), New XAttribute("source", "npm"), New XAttribute("spec", "2.7.3")) pluginElement.Add(New XElement("variable", New XAttribute("name", "LOCATION_ALWAYS_USAGE_DESCRIPTION"), New XAttribute("value", "Background location-tracking is required"))) pluginElement.Add(New XElement("variable", New XAttribute("name", "LOCATION_WHEN_IN_USE_USAGE_DESCRIPTION"), New XAttribute("value", "Background location-tracking is required"))) pluginElement.Add(New XElement("variable", New XAttribute("name", "MOTION_USAGE_DESCRIPTION"), New XAttribute("value", "Using the accelerometer increases battery-efficiency by intelligently toggling location-tracking only when the device is detected to be moving")))' pluginElement.Add(new XElement("variable", new XAttribute("name", "LICENSE"), new XAttribute("value", "YOUR_LICENSE_KEY"))); root.Add(pluginElement) root.Add(New XElement(phoneGapNamespace + "plugin", New XAttribute("name", "cordova-plugin-device"), New XAttribute("source", "npm"), New XAttribute("spec", "1.1.6")))EndSub
Take note of the commented out line of code, which adds the "LICENSE" attribute. If you have the license key, (refer to the corresponding remark in the README file), uncomment this code and replace the YOUR_LICENSE_KEY placeholder with your own key .

3.
 In the YourSolutionName.Module project, copy the BackgroundGeolocation.Module\BusinessObjects\DeviceInfo.xx file to the BusinessObjects folder.
This file contains business classes used to store background geolocation data received from mobile clients. You may want to put these classes into separate files according to your code rules.

4. In the YourSolutionName.Mobile project, create a new Geolocation folder and copy the several code files below into it as per the instructions below.
4.1. Copy the BackgroundGeolocation.Mobile\Geolocation\GeolocationScript.js file and include it in the project. Change the Build Action property for this file to Embedded Resource. This code initializes the Cordova Background Geolocation plugin with default settings. Feel free to modify it according to your needs. More information about configuring options can be found in the project's github repository.

4.2. Copy the BackgroundGeolocation.Mobile\Geolocation\GeolocationJsonObject.xx file and include it in the project.
These classes are used to deserialize JSON data set by mobile applications to the Geolocation Service.

4.3. 
Copy the BackgroundGeolocation.Mobile\Geolocation\GeolocationHttpHandler.xx file and include it in the project. 
The Background Geolocation plugin will send data to this service. The service is intended to save the device information to the database. It uses the connection string from the application configuration file (Web.config).

To enable the HTTP handler added on the previous step, add the following line to the configuration/system.webServer/handlers section of the YourSolutionName.Mobile/Web.config file (you may need to change the type attribute value and specify the namespace qualified name of the GeolocationHttpHandler class declared in your project:

[XML]
<addname="Geolocation"verb="GET,POST"path="GeolocationProcessingService.svc"type="YourSolutionName.Mobile.GeolocationHttpHandler"/>

5.  In the YourSoltutionName.Mobile/MobileApplication.xx file, register the GeolocationScript.js code (copied on step #4.1) using the MobileApplication.RegisterClientScriptOnApplicationStart method so that this script executes when the mobile application starts up on the device. The code snippet below demonstrates how to implement the ReadResource and ReadResourceString methods required to load the code from the embedded resource into a String variable (you can find this code in the BackgroundGeolocation.Mobile/MobileApplication.xx file of the sample project): 
[C#]
publicBackgroundGeolocationMobileApplication(){// ...stringgeolocationScript=ReadResourceString("BackgroundGeolocation.Mobile.Geolocation.GeolocationScript.js");RegisterClientScriptOnApplicationStart("GeolocationScript",geolocationScript);}publicstaticbyte[]ReadResource(stringresourceName){byte[]buffer=null;using(Streamstream=Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)){if(stream!=null){buffer=newbyte[stream.Length];stream.Read(buffer, 0,(int)stream.Length);}}returnbuffer;}publicstaticstringReadResourceString(stringresourceName){byte[]resourceBytes=ReadResource(resourceName);returnEncoding.UTF8.GetString(resourceBytes).Replace("\r\n","\\r\\n");}
[VB.NET]
PublicSubNew()' ...Dim geolocationScript AsString = ReadResourceString("GeolocationScript.js") RegisterClientScriptOnApplicationStart("GeolocationScript", geolocationScript)EndSubPublicSharedFunction ReadResource(ByVal resourceName AsString) AsByte()Dim buffer() AsByte = NothingUsing stream As Stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)If stream IsNot NothingThen buffer = NewByte(stream.Length - 1){} stream.Read(buffer, 0, CInt(stream.Length))EndIfEndUsingReturn bufferEndFunctionPublicSharedFunction ReadResourceString(ByVal resourceName AsString) AsStringDim resourceBytes() AsByte = ReadResource(resourceName)Return Encoding.UTF8.GetString(resourceBytes).Replace(ControlChars.CrLf, "\r\n")EndFunction
The value passed to the ReadResourceString method consists of two parts in C# projects: the default assembly namespace ("BackgroundGeolocation.Mobile") and the path to the resource file ("Geolocation.GeolocationScript.js"). The first part may be different in your project. In VB.NET projects, the resource name will be much simpler: "GeolocationScript.js". 

6. In the YourSolutionName.Module.Web project, install the Newtonsoft.Json NuGet package and copy the BackgroundGeolocation.Module.Web\Controllers\DisplayGeolocationController.xx file to the Controllers folder.
This controller is intended to draw the client's route based on location points.

7. Build and deploy your mobile application following the steps described in the Install the Application to a Smartphone  help article, and ensure that the Geolocation services are enabled in the mobile device settings.
Once you get your mobile app running on your actual device, wait a few minutes and then run the Web version of your XAF application. Open the DeviceInfo List View, and you will see a record containing your mobile device information. If you click the ListView record, you will be navigated to the DetailView that contains the Map demonstrating the route tracked by the Background Geolocation module.

See Also:
eXpressApp Framework > Getting Started > XAF Mobile (CTP) Tutorial
XAF Mobile - Overview Video
FAQ: New XAF HTML5/JavaScript mobile UI (CTP)
Using Maps in a Mobile Application 
How to send push notifications to the XAF Mobile application using Azure Notifications Hub
How to use a Barcode Scanner in XAF Mobile

How to: Store file attachments in the file system instead of the database (XPO)

$
0
0

Scenario
The FileSystemData module provides the FileSystemStoreObject and FileSystemLinkObject classes that implement the IFileData interface for the use with our File Attachments module.
FileSystemStoreObject - this class enables you to store uploaded files in a centralized file system location instead of the database. You can configure the file system store location via the static FileSystemDataModule.FileSystemStoreLocation property.
FileSystemLinkObject - this class enables you to add soft links to real files instead of saving their contents to the database. Apparently, it is intended for use in Windows Forms applications only.

Refer to the following video to see this functionality in action: http://www.screencast.com/t/Xl1GMfxw

Steps to implement
1. Copy and include the FileSystemData project into your solution and make sure it is built successfully.

2. Invoke the Module Designer for the YourSolutionName.Module/Module.xx file by double-clicking it in Solution Explorer. Invoke the Toolbox (Alt+X+T) and then drag & drop the FileSystemDataModule component into the modules list on the left.
3. Define a FileSystemStoreObject or FileSystemLinkObject type properties within your business class as described in the eXpressApp Framework > Task-Based Help > How to: Implement File Data Properties article. Make sure to decorate the container business class with the FileAttachmentAttribute (to provide additional commands for working with files) and also do not miss the Aggregated, ExpandObjectMembers(ExpandObjectMembers.Never) and ImmediatePostData attributes for the new class properties. See the E965.Module\BusinessObjects\FileSystemStoreObjectDemo.xx and E965.Module\BusinessObjects\FileSystemLinkObjectDemo.xx  source files for examples. 

4. Make sure you do not override the DevExpress.Persistent.BaseImpl.BaseObject.OidInitializationMode property in your application and related modules, because the OidInitializationMode.AfterConstruction value is necessary for the correct operation of this module (in the example, the required default value is already set in the FileSystemDataModule class of this example module).
5. Modify YourSolutionName.Win/WinApplication.xx file to handle the CustomOpenFileWithDefaultProgram event of the DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentsWindowsFormsModule class as shown in the E965.Win\WinApplication.xx file.

 

IMPORTANT NOTES
1.
The current version of this example does not support the middle-tier scenario. Refer to the Q476039 ticket for more details.

 

See Also:
File Attachments Module Overview
Working with links to files instead of storing their contents in the database
SQL Server FILESTREAM feature Overview

Question Comments

Added By: Roger Gardner at: 8/2/2012 4:36:37 AM    

-How to change FileStoreObject to work With Application server?
-How many files you can store in one folder and the system is not to slow?

Can this sample be upgraded with Application server and multiple folders in File Data Store folder?

Added By: Sander Mclean at: 8/22/2012 12:31:10 AM    

Thank you for your example, but could you upgrade this to VB.NET?

Added By: Martin Kraeuchi at: 10/12/2012 2:00:24 AM    

I tried to run this example but it crashes.
It occurs a fatal error when I try to append a file after creating a new "Standard File Data Demo" Item. The error occurs at the moment the file select box opens. I didn't found a way to debug it.
Do you have a glue what it could be?

My configuration:
Win7 64BIT, VS2010, v2012 vol 1.7, SQL Server Express 2008 R2

Thanks, Martin

Added By: Dennis (DevExpress Support) at: 11/29/2012 9:56:43 AM    

@Roger: I have not yet tested this module with the application server. It is a good idea, though. Thank you for your input, I have added it to my TODO list.

@Sander: It is quite complex a module to rewrite it in VB.NET, as well as maintain two versions later. Even though it is not in my immediate plans, you can either include the C# module project into your VB.NET solution (Visual Studio allows this) or rather use free or paid conversion tools.

@Martin: Thank you for your comment. Hm, it performs perfectly well for me. I also ran functional tests that passed locally. You are probably not using the latest version in this example. It would be great if you could create a separate ticket in the Support Center and attach the eXpressAppFramework.log file with the error details. Thank you in advance!

PS.
Sorry for the late reply, guys. In the future, it is better to submit a ticket directly via the http://www.devexpress.com/Support/Center/Question/Create link, if you experienced any difficulties with our tools.

Added By: ABRAMO ABRAMO at: 11/21/2013 11:44:40 AM    

Hi,
I'm working with Images in XAF application storing user image file to file system. So I'm using FileSystemStoreObject and It work fine for me. However, I've some problem!

one - I'd like split and save user images in FileData\<mykey1> folder where mykey1 depends by Business Objects instance1,
user images in FileData\<mykey2> folder where mykey2 depends by Business Objects instance2 and so on.
two - I'd like show stored images like Asp.net Images Slides Control or a link item in grid view to open images.

Do you have any suggestion or example?

Best regards,
Gaetano

Added By: Ricardo Granja at: 1/27/2014 4:36:39 AM    

Do vou have an exemple of this as a domain componente?

Regards,
Ricardo

Added By: xaero xy at: 6/2/2014 9:47:03 PM    

Did the "StandardFileDataDemo" store file attachments in database?

Added By: Dennis (DevExpress Support) at: 6/3/2014 2:24:48 AM    

@xaero: The StandardFileDataDemo class uses the FileData class that stores files in the database and which is a part of the standard delivery.

In turn, the FileSystemStoreObjectDemo class stores files in the file system with the help of custom IFileData implementations described in this example.

Added By: Steve Perks @ NSS at: 9/19/2014 4:11:17 AM    

Hi Dennis, thank you for the code - it works great in my web application (I'm only using the FileSystemStoreObject). I've made a mod to cover the case where the user has previously saved a business object and subsequently reloads it to edit the FileSystemStoreObject property, namely to pick a different file. In this case _tempFileName is not correctly populated and the old file is not deleted when the file is changed and the business object saved.

My solution was to add the following code to FileSystemStoreObject.cs

   protected override void OnLoaded()
   {
       base.OnLoaded();
       _tempFileName = this.RealFileName;
   }

Hope this helps others and perhaps you could update your code if you also feel this is a good solution.

Added By: Dennis (DevExpress Support) at: 9/19/2014 5:21:49 AM    

Thanks for sharing, Steve. Would you please either record a video showing how to replicate this behavior with the original example or create a functional EasyTest script covering this scenario? This will help me better understand the situation and make changes, if necessary. Thanks in advance! 

Added By: Steve Perks @ NSS at: 9/19/2014 5:47:52 AM    

Dennis, how shall I send the video? No attachments in this thread.

Added By: Steve Perks @ NSS at: 9/19/2014 6:09:35 AM    

It's ok about sending the video, I've decided to host it for a short while here: http://host21.co.uk/e965/

Added By: Dennis (DevExpress Support) at: 9/19/2014 6:13:09 AM    Thanks for your video, Steve. I will take this scenario into account  for future updates.Added By: Genesis Supsup 1 at: 12/30/2015 2:07:35 AM    

Does this already work using Application Server? Given the correct credentials, will this concept work with Dropbox (in replacement to File System)?

Added By: Alexey (DevExpress Support) at: 12/30/2015 9:27:28 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T329782: E965 with dropbox. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Joseph Kellerer 2 at: 2/26/2016 4:17:30 AM    Thank you for providing this code!
It works great.

I have enhanced the FileSystemStoreObject to have a Content property like in the BaseImpl.FileData class:

[C#]
[NonPersistent]publicbyte[]Content{get{returnFile.ReadAllBytes(this.RealFileName);}set{this.TempSourceStream=newMemoryStream(value);}}
Added By: CHRIS TSELEBIS at: 3/16/2016 7:27:47 AM    The deletion is not working correctly on the detailview.  I hit delete, filed is deleted but gets an error message saying "requested objects canot be loaded, because they are abasent in the data store....".  It works fine in the listview.  Please check.
Added By: Dennis (DevExpress Support) at: 3/17/2016 2:11:50 AM    @Chris: Thanks for your feedback. In the meantime, you can remove the DeferredDeletion(false) attribute declaration from the FileSystemStoreObject class as a solution.Added By: CHRIS TSELEBIS at: 3/17/2016 10:12:53 AM    Dennis,  is it possible to make the textbox(filename) bigger?  I tried to set the width and height on detailview and no success.  Right now it's just using one row and no way to set rowcount for this field.  I want the textbox to be bigger so it's easier for user to drag and drop on detailview.
Added By: Dennis (DevExpress Support) at: 3/18/2016 2:39:43 AM    

@Chris: To process your recent post more efficiently, I created a separate ticket on your behalf: T358143: How to set the width and height of the FileData PropertyEditor control. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates. For better tracking, please also use the https://www.devexpress.com/Support/Center/Question/Create service to submit new questions regarding this or any other XAF functionality. Thanks for your understanding.

Added By: Joseph Kellerer 2 at: 10/20/2016 5:37:28 AM    If I edit an oject which uses an FileSystemStoreObject
AND
change the file name,
the old file remained and was not deleted.


After I changed LoadFromStream method to
[C#]
voidIFileData.LoadFromStream(stringfileName,Streamsource){//Dennis: When assigning a new file we need to save the name of the old file to remove it from the store in the future.if(fileName!=FileName)// changed, old code was if (string.IsNullOrEmpty(tempFileName))tempFileName=RealFileName;FileName=fileName;TempSourceStream=source;}


it works.
Added By: Andrew L (DevExpress Support) at: 10/21/2016 5:48:53 AM    

Hello Joseph,

Thank you for your comment.
We will consider your use case and possibly incorporate the changes you suggested to this example.

Added By: Alan Pérez 1 at: 11/26/2016 4:19:09 PM    Hi, I'm using this code, but, i have the error when i want to attach a file > 2 Gb size, how can i remove this limitant?

if (value.Length > (long)int.MaxValue) throw new UserFriendlyException("File is too long");



Added By: Dennis (DevExpress Support) at: 11/28/2016 12:45:43 AM    

@Alan: I've created a separate ticket on your behalf (T455721: Increase default attachment size in E965). It has been placed in our processing queue and will be answered shortly.

Added By: Fitzroy F. Wright at: 3/22/2017 12:21:35 PM    I need help figuring out how to tell this module to use the value in Options->Attachments->DefaultDirectory Attribute in Model.xafml in my App.WIn project as the default locations to store attachments in the file System.

Can you help?

Added By: Dennis (DevExpress Support) at: 3/22/2017 11:58:39 PM    

@Fitzroy F. Wright:
I've created a separate ticket on your behalf (T495520: E965 - How to read the default directory path from a custom element in the Application Model). It has been placed in our processing queue and will be answered shortly.

Added By: Giuseppe Ascione at: 7/19/2017 3:51:42 AM    Hi Support, this extension support the 1 to N relation?
I have try to add this property to my class:
[C#]
[Aggregated][Association("PPM_ProjectPortfolio-PPM_Attachments")][ImmediatePostData]//[ExpandObjectMembers(ExpandObjectMembers.Never)]publicXPCollection<FileSystemStoreObject>Attachments{get{returnGetCollection<FileSystemStoreObject>("Attachments");}}

and the related association un the other class:
[C#]
protectedPPM_ProjectPortfoliopPM_ProjectPortfolio;[Persistent,Association("PPM_ProjectPortfolio-PPM_Attachments")]publicPPM_ProjectPortfolioPPM_ProjectPortfolio{get{returnpPM_ProjectPortfolio;}set{SetPropertyValue("PPM_ProjectPortfolio",refpPM_ProjectPortfolio,value);}}
but when i open the detailview and is see the list of attachement, i clic to add and I do not see the browse button. Only the  FileSystemStoreObject like FileName.

Thanks
Giuseppe
Added By: Dennis (DevExpress Support) at: 7/19/2017 5:42:17 AM    

@Giuseppe:
I've created a separate ticket on your behalf (T537361: Associations with FileSystemStoreObject from E965). It has been placed in our processing queue and will be answered shortly.
For the future, please use the https://www.devexpress.com/Support/Center/Question/Create service to submit new questions regarding this or any other XAF functionality. Thanks for your understanding.

Bootstrap Controls - How to implement Theme Switcher

$
0
0

This example demonstrates the way of creating a Bootstrap Theme Switcher User Control as in Devexpress Bootstrap demos (all themes are taken from the Bootswatch web site).
The selected theme name is stored in cookies.
HOW TO APPLY:
1. Add all three files in App_Code directory: BootstrapThemeModel.cs, BundleConfig.cs, ThemeModelBase.cs;
2. Add User Control BootstrapThemeSwitcher and register and add it on the page. In this example, it's registered and added on the Master Page Site.master; 
3. Add the SwitcherResources folder. It contains the Content and Scripts folders, the client resources for Theme Switcher User Control and Themes.xml file which contains the list of Bootstrap Themes.
After performing all actions above, you will have an attractive Theme Switcher like in our demos.

Report Server - How to get the list of available reports and display a report preview in a Windows Forms application

$
0
0

The sample demonstrates how to use the Report Server WCF API in a Windows Forms application.

Question Comments

Added By: Juan Carlos Cabrera 1 at: 4/21/2014 5:13:55 PM    

Hello!!... I have a question... What is ReportViewerForm?. Thanks

Added By: Igor D (DevExpress) at: 4/22/2014 1:22:12 AM    

Hi!
 
ReportViewerForm, as the name suggests, is a form with the DocumentViwer control. Please download the example to see the full source code.

Added By: Juan Carlos Cabrera 1 at: 4/22/2014 8:35:33 AM    

ooohhh!!... very good... it ́s great. Thanks

Added By: Pavan kumar 54 at: 8/12/2015 5:41:39 AM    

Thank you for the response, Don't i get an example in asp.net c# as our application is an asp.net application. Please suggest if you can help me this

Added By: Dmitry Tok (DevExpress Support) at: 8/12/2015 6:53:11 AM    

Hello Pavan,

We have a corresponding Code Example available for web platform Report Server - How to get the list of available reports and display a report preview in an ASP.NET MVC application. It would be great if you register a separate thread regarding the issue if this example doesn't help.

Thanks,
Dmitry

Added By: Pavan kumar 54 at: 8/19/2015 1:26:48 AM    

Hello Dmitry,

I have no experience with MVC and require asp.net code for me to close this thread. Please provide asp.net sample for this issue.Very important .

Thanks
Pavan

Added By: Yaroslav (DevExpress Support) at: 8/19/2015 3:33:22 AM    

Hi  Pavan,
I see that you've published exactly the same request in the How can i bind all the reports created in report server in my custom application thread. Let's continue our conversation there. 

Added By: celso coelho 1 at: 10/26/2016 2:36:39 AM    Is it possible to print the report directly without preview insted of export to pdf?Added By: Jannet (DevExpress Support) at: 10/26/2016 6:48:03 AM    Hello Celso,
I see that you submitted a separate ticket regarding this task: Print Report Server direcly without preview. Let's continue our discussion there.Added By: John Molloy 2 at: 8/23/2017 5:40:30 AM    

Hi
I am using this to get a list of Reports, form the Server, but it onlys seems to give Reports no Dashboards
?

Added By: Dmitry Tok (DevExpress Support) at: 8/23/2017 6:19:59 AM    Hi John,

This Code Example demonstrates how to obtain the reports only. The API for obtaining the dashboards isn't ready yet and for now there is no way to achieve this goal. 

How to open DetailView by clicking a grid row in the integrated Dashboard

$
0
0
Scenario
This example describes how to invoke a Detail View when a user clicks a row in the GridDashboardItem created using the Dashboard Module. In the invoked Detail View, a user can view or edit a business object corresponding to the clicked row.

Prerequirement
Add a key property to the hidden measures of a Dashboard and set its summary type to Min or Max. The key property in this example is Oid.

                        

WinForms Example (WinShowDetailViewFromDashboardController)

1. Add a View Controller to the WinForms module project.
2. Access the DevExpress.ExpressApp.Dashboards.Win.WinDashboardViewerViewItem, as described in the How to: Access the Dashboard Control topic.
3. In the DevExpress.ExpressApp.Editors.ViewItem.ControlCreated event handler, subscribe to the DevExpress.DashboardWin.DashboardViewer.DashboardItemControlCreated event.
4. In the DashboardItemControlCreated event handler, access the DashboardViewer and subscribe to the DashboardViewer.DashboardItemDoubleClick event.
5. In the DashboardItemDoubleClick event handler, get the key property value using the DashboardItemMouseActionEventArgs arguments.
6. Add a DevExpress.ExpressApp.Actions.ParametrizedAction to the Controller and force its execution in the DashboardItemDoubleClick event handler. The Action in the example is invisible because its category ("Dashboard") does not match any existing Action Container. However, you still can execute it in code using the DoExecute method.
7. In the DevExpress.ExpressApp.Actions.ParametrizedAction.Execute event handler, create a new Object Space and find the clicked object using the DevExpress.ExpressApp.IObjectSpace.FindObject method.
8. Pass the found object to the DevExpress.ExpressApp.XafApplication.CreateDetailView method to create a Detail View.
9. Pass the created Detail View to the DevExpress.ExpressApp.ShowViewParameters.CreatedView event argument to display it.

ASP.NET Example (WebShowDetailViewFromDashboardController)

1. Add a View Controller to the ASP.NET module project.
2. Access the DevExpress.ExpressApp.Dashboards.Web.WebDashboardViewerViewItem as described in the How to: Access the Dashboard Control topic.
3. Add a handler to the client-side DevExpress.DashboardWeb.Scripts.ASPxClientDashboard.ItemClick event.
4. In this event handler, get the key property value using the ASPxClientDashboardItemClickEventArgs arguments.
5. Generate a callback on the client side (in the ASPxClientDashboard item click handler) and process it on the server side (see How to raise XAF callbacks from client-side events and process them on the server).
6. Add a DevExpress.ExpressApp.Actions.ParametrizedAction to the Controller and force its execution in the IXafCallbackHandler.ProcessAction method implementation. The Action in the example is invisible because its category ("Dashboard") does not match any existing Action Container. However, you still can execute it in code using the DoExecute method.
7. In the DevExpress.ExpressApp.Actions.ParametrizedAction.Execute event handler, create a new Object Space and find the clicked object using the DevExpress.ExpressApp.IObjectSpace.FindObject method.
8. Pass the found object to the DevExpress.ExpressApp.XafApplication.CreateDetailView method to create a Detail View.
9. Pass the created Detail View to the DevExpress.ExpressApp.ShowViewParameters.CreatedView event argument to display it.

How to obtain visible time intervals using client-side methods

$
0
0

This example illustrates how to obtain the currently visible time intervals using the client-side GetVisibleIntervals method. The Start and End of each time interval are displayed in the top panel on the page.

OBSOLETE - How to focus a search box corresponding to the FullTextFilterAction, once a root ListView is opened in a Windows Forms application

$
0
0

============
This approach is obsolete. Refer to the How to set focus to a ParametrizedAction (Full Text Search) in code article instead.
============
This example demonstrates how to focus a search box corresponding to the FullTextFilterAction, once a root ListView is opened. This may be convenient for some end-users wanting to start searching data instantly.
This solution supports both standard bars and ribbon interfaces, though a slightly different code is necessary for that.

See Also:
OBSOLETE - How to customize the settings of a toolbar item created for an Action
How to create a custom action type with a custom control (BarCheckItem), associated with it

ASPxGridView - How to undo changes for a cell in Batch Edit Mode

$
0
0

This example demonstrates two approaches to reset cell changes.
1) It is allowed to reset changes for a cell via the context menu item.
2) It is possible to undo the last change of the modified cell value using 'Ctrl+Z' hot keys.
For detailed information, see Implementation Details.
If you wish to use both approaches at once in your project, you need to synchronize the changedCells stack from the 'HotKey' approach with actual cells that were changed after resetting a value via the context menu item.








How to draw a logo on RibbonControl

$
0
0

This example demonstrates how to create a helper component that allows drawing a logo at the right side of the RibbonControl.

IMPORTANT: Starting with v16.2, RibbonControl provides the RibbonControl.Image Property that allows you to put a background image to the control. If the built-in alignment options aren't enough for you, use this example.


To use this helper in your project, drop it onto the form from the Visual Studio ToolBox (you need to rebuild the project first). Then, set the RibbonControl and Image properties. If you wish to provide more complex logic, for example, draw this logo on a specific Ribbon page, go to the RibbonLogoHelper.DrawRibbonLogo method and add the required condition there.

Question Comments

Added By: Jürgen Becker at: 12/20/2016 3:42:43 AM    Hi,

works like a charm. I like it.

Regards Jürgen

dxDataGrid - How to use dxDropDownBox as a column editor in edit mode

$
0
0

This example illustrates how to use dxDropDownBox with an embedded dxDataGrid for editing data. Run the example and check the State column to see this approach in action.

Click the "Show Implementation Details" link to see step-by-step instructions.

Viewing all 7205 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>