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

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

$
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.


Spreadsheet Document Server API

$
0
0

This example demonstrates how to use the Spreadsheet Document Server API to programmatically manage spreadsheet documents, without the need for Microsoft Excel to be installed.

In particular, this sample introduces API properties and methods used to perform the following operations:

- Manage worksheets (activate, create, delete, rename, move, copy, show/hide worksheets, adjust worksheet view, etc.)

- Manipulate rows and columns (insert, delete, copy, show/hide, group rows and columns, adjust row height and column width, etc.)

- Manipulate cells and cell ranges (set cell values, add hyperlinks to cells, name, copy and merge cells)

- Create formulas (use various functions and cell references in formulas, name formulas and use names in formulas, create shared and array formulas, etc.)

- Format cells (create, modify and apply styles, set cell font, colors, alignment, borders, number format, etc.)

- Import data from different sources

- Export the workbook to PDF

- Print the workbook

For more information, review the Examples section in the documentation.

The Universal Subscription or an additional Document Server Subscription is required to use this example in production code. Please refer to the DevExpress Subscription page for pricing information.

Question Comments

Added By: Joseph Marlin at: 6/2/2016 8:09:34 AM    Where does this code show how to create a new workbook?Added By: George (DevExpress Support) at: 6/2/2016 8:25:01 AM    

Hi,


There is no such code in this example. Please check the How to: Create a New Workbook documentation article to see how to do that.

Added By: George (DevExpress Support) at: 6/2/2016 8:31:08 AM    Just a follow-up.

I have passed your feedback to our technical writers, so this example will be updated to illustrate how to do that.

(Obsolete) How to display a login view as a popup window during navigation between views

$
0
0

Starting with 14.2, please use this example.
This approach can be applied starting with 13.2.9. 

This example demonstrates how to check whether the user is logged in and display a login view when it is necessary during navigation.

It is necessary to perform the following steps to accomplish this task:

1. Add a new view and place a dxPopup in it.

2. Implement the required logic for this view in a corresponding view model.

3. Handle the HtmlApplication.initialized event. In this event handler, get the login view template using the HtmlApplication.getViewTemplate method and add the view to the view port. This will allow you to display its internal popup using options from its view model.

4. Bind the login view model to the view markup using Knockout.

5. Declare a global variable for determining when a user is logged in. In this example we set this option to false by default, and we will set it to true when a user is logged in. This variable can be accessed from any part of the application and we can change its value in the login view model.

6. Handle the HtmlApplication.navigating event. In this event handler, we can get a view info (see HtmlApplication.getViewTemplateInfo) for the navigated view and check user credentials if necessary. For this purpose, we added the secure option to those views that should not be displayed for unauthorized users. If the user unauthorized, we can call a method from the login view model to display dxPopup from the login view. Moreover, you can cancel navigation by setting the cancel parameter of the event handler to true.

See also:
How to send authenticated requests to the OData service

Question Comments

Added By: Alexandre Henriques at: 4/28/2014 7:36:44 AM    

How do I make this piece of code in version 13.2.7?

app.initialized.add(function() {
       var $view = app.getViewTemplate("LogOnPopup");
       $view.appendTo(".dx-viewport");
       LogOnAsPopupView.loggedOn = ko.observable(false);
       LogOnAsPopupView.logOnPopupViewModel = LogOnAsPopupView.LogOnPopup();
       ko.applyBindings(LogOnAsPopupView.logOnPopupViewModel, $view[0]);
   });

Added By: Nikolai (DevExpress Support) at: 4/28/2014 11:00:20 PM    Hi Alexandre,

I have created a separate ticket for this issue. Please post comments to the How to display a login view as a popup window during navigation between views (13.2.7) ticket.Added By: Faraz Faheem at: 6/1/2014 3:28:54 AM    

Im having error on initialized event. Error says 'Error: cannot ready property 'add' of undefined' on app.initialized.add(funtion() { line.

Please help me

Added By: Faraz Faheem at: 6/1/2014 3:52:38 AM    

I just upgraded my project to 13.2.9 by project converter and viola everything works.

Thanks for the self-explanatory post.

Added By: Nikolai (DevExpress Support) at: 6/2/2014 12:15:33 AM    You are always welcome, Faraz.Added By: Faraz Faheem at: 6/3/2014 7:56:19 AM    

Hi Nikolai,

With authentication implementation, my LogOn.js file looks like below
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AESalesApp.LogOnPopup = function (params) {

   var viewModel = {
       userid: ko.observable(""),
       password: ko.observable(""),
       visible: ko.observable(false),
       authenticated: ko.observable(false),
       redirectParam: this.redirectParams,
       logOn: function () {

           var user = {
               Name: this.userid(),
               UserName: this.userid()
           };
        
           AESalesApp.UserDb.authenticateUser(user).done(function (data) {

               AESalesApp.loggedOn(true);

               AESalesApp.credentialStore.insert({
                id: 1,
                accessToken: "34234234234234234",
                expiry: 234,
                refreshToken: "134234234234234",
                name: "faraz"
                });

               if (viewModel.redirectParam) {
                   AESalesApp.app.navigate(viewModel.redirectParam.uri, viewModel.redirectParam.options);
               }
               viewModel.close();

           });
       
       },
       show: function (redirectParams) {
           viewModel.visible(true);
           viewModel.redirectParam = redirectParams;
       },
       close: function () {
           viewModel.visible(false);
           delete viewModel.redirectParam;
       }
   };

   return viewModel;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
where:
AESalesApp.UserDb is CustomStore getting data from Web Api. It is working fine and data is coming back from authenticalUser call.

I am having 2 problems here.
1. Done function param 'data' is not getting results from authenticateUser function  
2. Popup is not closing down

Added By: Nikolai (DevExpress Support) at: 6/4/2014 2:40:03 AM    Hi Faraz,

I have created a separate ticket for this issue. Please post all comments in the How to implement authentication with a popup login viewAdded By: Jerther at: 11/28/2014 2:08:30 PM    

this line should be updated:

<div data-bind="dxTextBox:{ type: 'password', value: password }"></div>

with

<div data-bind="dxTextBox:{ mode: 'password', value: password }"></div>

Added By: Nikolai (DevExpress Support) at: 12/1/2014 3:52:34 AM    Hi Jerther,

Thank you for bringing this to our attention. I've updated this example.Added By: V.Mangione at: 12/4/2014 7:55:59 AM    

Hi, this sample doesn't appear to be working anymore on just released v 14.2.3
The popup stays hidden.

Added By: Nikolai (DevExpress Support) at: 12/5/2014 2:23:56 AM    Hi,

Starting with 14.2, please use this example.Added By: IMiron at: 10/9/2015 2:06:22 PM    

Hi,

Can you please tell me how this can be accomplished with the Angular approach?
A sample would be best.

Thanks,
Ionut.

Added By: Nikolai (DevExpress Support) at: 10/12/2015 1:38:07 AM    Hello IMiron,

The DevExtreme framework is based on KnockoutJS and jQuery. AngularJS has its own navigation mechanism. I suggest that you refer to Angular documentation and forums regarding this issue.

See also:
ngView
Routing & Multiple ViewsAdded By: Julian Leung at: 4/6/2016 9:07:30 PM    I am using this login sample, but I got some problems when I change the dxList to dxDataGrid. I seems that the problem come from data source, it cannot get the data from it.

        <div data-bind="dxDataGrid: { dataSource: dataSource,                 columns: [                    { dataField: 'ItemCode'},                    { dataField: 'BatchNum'},                      ] 

                  }">


var dataSource = {    store: new DevExpress.data.CustomStore({        load: function () {            return $.getJSON('http://localhost:55960/DataService.svc/efSeason');        }    })}


Added By: Nikolai (DevExpress Support) at: 4/7/2016 3:55:00 AM    

Hello Julian,

To process your recent post more efficiently, I created a separate ticket on your behalf: T365094: dxDataGrid - Ho to implement a custom data source. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Hari Setyawan 2 at: 6/3/2016 2:27:49 AM    Why do I get an error, Cannot read property 'secure' of undefined'?

How to get all images provided by the DevExpress Icon Library

$
0
0
The following example demonstrates how to get information about file names and images, stored in the DevExpress Icon Collection.
Question Comments

Added By: Rennie Petersen at: 6/3/2016 3:54:19 PM    For what it's worth, here's an alternative version that retrieves all of the icons in one run.

[C#]
usingSystem;usingSystem.IO;usingDevExpress.Images;namespaceGetIconLibrary{classProgram{staticvoidMain(string[]args){stringfilePathRoot=@"E:\Icons\DevExpress Icon Library\";foreach(ImagesAssemblyImageInfoimageInfoinImagesAssemblyImageList.Images){stringimageType=imageInfo.ImageType.ToString();stringimageSize=imageInfo.Size.ToString();stringfilePathSpecific=Path.Combine(filePathRoot,imageType,imageSize);if(!Directory.Exists(filePathSpecific)){try{Directory.CreateDirectory(filePathSpecific);}catch(Exceptione){Console.WriteLine("Can't create a directory: {0}",e.ToString());}finally{}}using(Streamstr=ImageResourceCache.Default.GetResourceByFileName(imageInfo.Name)){if(str!=null&&str.CanRead){using(FileStreamfileStream=File.Create(filePathSpecific+"\\"+imageInfo.Name)){str.CopyTo(fileStream);Console.WriteLine("Writing "+imageInfo.Name);}}}}}}}



How to implement the Hand Tool functionality for the DocumentViewer for WPF

Capability for a single column to fill an empty space in a grid view

$
0
0

In this example we added a FillEmptySpace option to the GridColumn descendant. Only one column in the grid view can have this option enabled, i.e. if you set the FillEmptySpace property to true for a single column other columns immediately set this option to false themselves. Column with this option enabled now recalculates its width after every layout change in order to fill an empty space in the grid view. This feature won't work if the grid view's option OptionsView.ColumnAutoWidth is enabled.

Question Comments

Added By: Eduardo Ramirez at: 10/28/2014 11:47:25 AM    

Hi folks,

would you mind to attach an example using the code below?

Thanks in advanced.
Eduardo

Added By: Nikita (DevExpress Support) at: 10/29/2014 1:43:16 AM    

Hello,
You can download the project for this example by a link on a right panel (see the screenshot in the attachment). First you have to download the Example Runner, then use this runner to open the *.dxsample file. 
I hope this helps. 

Added By: Simon Hewitt at: 12/17/2015 3:10:30 AM    

Needs a bit of tweaking in RecalculateColumnWidths to exclude summing columns with GroupIndex >= 0 (unless OptionsView.ShowGroupedColumns == true)

Added By: Nadezhda (DevExpress Support) at: 12/17/2015 8:55:00 AM    As far as I understand, your issue has been resolved. Please do not hesitate to contact us in case of any difficulty. We will be happy to help you!Added By: Crealogix AG at: 12/22/2015 12:31:18 AM    

please note:
- doesn't take into account grouped columns
- if the user manually chooses "best fit column" or "best fit all columns" from the context menu, the results are weird.

Added By: Sasha (DevExpress Support) at: 12/22/2015 9:09:02 AM    

Hello,
I've created a separate ticket on your behalf: The 'Capability for a single column to fill an empty space in a grid view' example works incorrectly in certain scenarios . Let us continue our discussion in this thread.

Added By: deyvi saavedra at: 6/5/2016 8:43:35 PM    I am from peru, I want to know how to call the "FillEmptySpace" property and I have the FillGridColumn classes. I leave a picture.
Note: commented lines is correct if or not.
Imagen Added By: Svetlana (DevExpress Support) at: 6/6/2016 2:03:55 AM    

Hello,

I've created a separate ticket on your behalf (T388227: How to make a single column to fill an empty space in a grid view). It has been placed in our processing queue and will be answered shortly.

How to send authenticated requests to the OData service

$
0
0

This example demonstrates how to send authenticated requests to the OData service. The main idea is to handle the ODataContext.beforeSend event and add login information to the header of your request.

The How to process authenticated requests on the OData service example demonstrates how to process requests on the server side.

Question Comments

Added By: Phil Jenson at: 1/28/2013 3:12:21 AM    

I believe 'beforeSend' function should be a member of the ODataContext and not a member of the CategoryList object.

Added By: Hasan Baidoon at: 7/9/2013 10:33:08 PM    

Hi,

I want to know if this method for Basic Authorization works when JSONP is enabled.

Thanks.

Added By: Onkelinx Ghislain at: 2/13/2014 2:06:23 PM    

Which version of visual studio works this example?

Added By: surekha at: 11/3/2015 2:26:49 AM    

THis code is not worrking. error comes app not defined. how i can resolve this error.

Added By: Mark Hartmann at: 11/3/2015 2:34:36 AM    

Change line "app.navigate('Login');" to navigate to your login page according to your other code.

Added By: Nikolai (DevExpress Support) at: 11/3/2015 7:32:12 AM    Hi Guys,

Surekha, please follow the recommendations from the Mark's comment. If this does not help, describe how we can reproduce the issue with this example. We will do our best to assist you.Added By: Luong Tu at: 11/29/2015 6:16:39 PM    

this example  isn't working for me

Added By: MohammedFarooq at: 11/29/2015 9:41:15 PM    

Hi Nikolai,

This example seems to be incomplete as it doesn't have the OData Service project included in it to demonstrate the functionality.

I would appreciate if you can create the ODataService project and demonstrate the example fully.

Added By: Nikolai (DevExpress Support) at: 11/29/2015 11:45:37 PM    Hi Guys,

Please take a closer look at the example description. It contains a link to the required examaple that demonstrates how to process requests on the server side.Added By: saliha mali at: 12/27/2015 7:22:19 AM    

please I'm getting this error
"Error: 'ReferenceError: app is not defined', line 14, file 'http://localhost:64254/views/login.js'&quot;

Can you help me for this?

Added By: Nikolai (DevExpress Support) at: 12/28/2015 1:03:28 AM    

Hello Saliha,

To process your recent post more efficiently, I created a separate ticket on your behalf: T328732: Cannot test the E4460 example due to the "app is not defined" error. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: saliha mali at: 12/29/2015 12:41:55 AM    

It's ok. I prefixed the "app" with the name of my application. Now the error is not displayed. (Guess I get it)
but i'd like to know where should I put the db.js?  Is it in the same folder as "login" and "index" ?
Because I got this error :
"Error: 'TypeError:  TestApp.db is undefined', line 4, file 'http://localhost:54294/views/index.js'.&quot;

Added By: Nikolai (DevExpress Support) at: 12/29/2015 1:01:42 AM    Saliha,

You can place the db.js file into any folder. The main requirement is that a reference to this file should be placed before a reference to index.js. 

Added By: saliha mali at: 12/29/2015 1:33:42 PM    

I did not understand what does "db.js" really do?

Here are the sequence of ideas in my head:

1- User enter his (UserName & password) then click LoginButton
2- the index page is shown and it is expected to display a list of categories. The data source of this page is the "CategoryList"

Now I don't understand what is exactly the "categoryList". Is it a table in the DB which is linked to My OdataService?
what do this two lines mean :
key: "CategoryID",
name: "Categories"

So briedfly I need more explanation to make the db.js clear in my head?
thks to help.

Added By: Nikolai (DevExpress Support) at: 12/30/2015 12:36:45 AM    Saliha,

I kindly ask you not to post the same comments in different tickets. Let's discuss this issue in the Cannot test the E4460 example due to the "app is not defined" error ticket.Added By: Şule ışık at: 4/22/2016 12:40:20 AM    Hi,
I try login app. But  I  receiving error. this error is 

Uncaught ReferenceError: Unable to process binding "dxTextBox: function (){return { value:txtUsername} }"
 What is the problem? Added By: Şule ışık at: 4/22/2016 12:59:00 AM     When I wrote "value: anything" , I'm getting error .  Why?

Added By: Nikolai (DevExpress Support) at: 4/22/2016 3:52:42 AM    

Hello Şule,

I've created a separate ticket on your behalf (T370893: The E4460 example throws error). It has been placed in our processing queue and will be answered shortly.

Added By: Hari Setyawan 2 at: 6/5/2016 7:44:25 PM    Hi, I've tried the example, but it gave me this error
Error: 'Uncaught TypeError: Cannot read property 'disable' of undefined', line 9, file 'http://localhost:61289/js/dx.all.js'. Added By: Nikolai (DevExpress Support) at: 6/6/2016 6:22:07 AM    

Hello Hari,

I've created a separate ticket on your behalf (E4460: How to send authenticated requests to the OData service). It has been placed in our processing queue and will be answered shortly.

How to: Implement a Custom Report Class


How to show progress in XtraTabControl's page header

$
0
0

This example demonstrates how to create a custom XtraTabPage, that allows you to show a progress bar in its header.

Question Comments

Added By: Antonio Rubin at: 6/7/2016 10:53:19 AM    This actually pretty great...
I was thinking, though...Is is possible to have each tab be its own progress bar? I have a lot of controls loading and it'd be nice for the user to see which tabs' controls are completed and see each one progress visually... Added By: Nadezhda (DevExpress Support) at: 6/8/2016 12:15:40 AM    

Hello Antonio,

As far as I understand, you have created a separate ticket with a similar issue: XtraTabControl XtraTab ProgressBar In Tab. This ticket is currently in our processing queue. Our team will reply to you there shortly.

How to implement custom filtering in XtraTreeList

$
0
0

The current example demonstrates how a custom filtering algorithm in XtraTreeList can be implemented. The current example implements logic as follows:
- If a current node matches the filtering pattern, then this node and all its antecedent nodes should be shown; otherwise, the node should be hidden;
- If a parent node doesn't have any visible child nodes, then such node should be hidden.

Question Comments

Added By: Hannes Schneider at: 6/8/2016 2:20:35 AM    nice example, but how do i connect the applyFilterButton_Click event?Added By: Alexey Z (DevExpress Support) at: 6/8/2016 3:51:07 AM    

Hello,

As far as I can see, you have already created a thread with the same question - Custom filter event. So, let's continue our discussion there.

GridView - How to implement a popup Edit Form when the Batch Edit mode is used

$
0
0

This example demonstrates how to implement editing in the popup's Edit Form when the grid's Batch Edit mode is used. The main idea is to create editors for all editable fields of the grid. Then, after filling the fields, all values are set to the grid with the ASPxClientGridView.batchEditApi.SetCellValue method. 

How to disable some dates in DateEdit

$
0
0

This example shows how to disable a custom set of dates in the DateEdit control.

The main idea of the approach is to add a collection of disabled dates to the DateEdit's Tag property and disable corresponding calendar buttons by using a DataTrigger with a custom MultiConverter. This MultiConverter checks if a date associated with a certain button exists in the collection of disabled dates. If so, the button's IsEnabled property is set to False.

 

To avoid posting disabled data when the keyboard is used instead of the mouse, the implementation of the DateEditCalendar class and its OnCellButtonClick method was also changed. This custom DateEditCalendar is used in DateEdit's popup with the help of an implicit style for the DateEdit type.

How to horizontally merge cells in VGridControl

$
0
0

This example demonstrates how to create a custom VGridControl and manually paint required cells to merge them horizontally.

Question Comments

Added By: Kinjal Nandu at: 6/10/2016 4:39:54 AM    There seems to be something missing in the code when I try to run it on my machine.
1. The variable  vGridControl1 is not declared anywhere but used in Form1.cs
2. The method CreatePainterCore() is not used anywhere - where is it supposed to be called?
Is there a designer file missing?

How to represent an enumeration property via a drop-down box with check boxes

$
0
0

Scenario:

There is an enumeration type decorated with the FlagsAttribute, which means that an enumeration can be treated as a set of flags. There is also a property of this enumeration type inside the business class. This is helpful when several predefined enumeration values can be stored using this data property. In the UI, this data property is usually represented via an editor with multiple check boxes:


Steps To Implement:

Since there is no standard  PropertyEditor for enumerations that would allow you to store several values at once, it is common to implement custom Property Editors for this task. A custom PropertyEditor will take data property value as its input and represent it in the UI using a custom visual control. There will be one PropertyEditor for WinForms (based on the CheckedComboBoxEdit control from the XtraEditors Suite) and one for ASP.NET (based on the ASPxGridLookup control from our ASPxGridView and Editors Suite), because there is no platform-agnostic way to achieve such a look and feel.


Consider following the steps below to implement and use editors from this example in your project.
1. Implement an enumeration type decorated with the FlagsAttribute as shown in the E689.Module\BusinessObjects\DemoObjects.xx file;
2. Copy the E689.Module.Win\Editors\EnumPropertyEditorEx.xx file into YourSolutionName.Module.Win project;
3. Copy the E689.Module.Web\Editors\ASPxEnumPropertyEditorEx.xx file into YourSolutionName.Module.Web project;
4. Build the solution and invoke the Model Editor for the ModelDesignedDiffs.xafml files from YourSolutionName.Module.Win and YourSolutionName.Module.Web projects.

5. Locate the BOModel | YourClassName | Members | YourEnumerationProperty node and set its PropertyEditorType property to the corresponding EnumPropertyEditorEx types.

 

See Also:

Implement Custom Property Editors
How to represent a enumeration property via radio buttons or check boxes on the Web

Question Comments

Added By: Pawel Botwina at: 7/6/2013 1:11:36 AM    

Hello,

How can I filter by flags enum property in the server mode? I mean filtering the ListView by AutoFilterRow.

Added By: Alex Kads at: 4/4/2014 2:35:40 PM    

would that same code for WEB

Added By: Dennis (DevExpress Support) at: 4/8/2014 12:45:41 AM    

@Alex: While we do not have a ready Web version of this example, you may find the code from the E1807 example helpful. Thanks.

Added By: Anatol (DevExpress Support) at: 4/9/2014 9:32:02 AM    

Web version is added.

Added By: Leong Vai Long at: 5/14/2014 3:22:04 AM    

Hi, I had try this method for the XAF web version. The question is how i want to use the XAF Display Name to show in the lookup? bcos I only see the enum values.
Thanks.

Added By: Dennis (DevExpress Support) at: 5/14/2014 9:09:47 AM    

@Leong: This particular functionality is not implemented in this example solution. You would need to modify the E689.Module.Web.Editors.EnumPropertyEditorEx class to achieve this. While we do not have a ready sample, feel free to contact our ASP.NET team on how to implement your task with the ASPxGridLookup component used in this example. Once you receive a solution for this component, it can be easily integrated in XAF.

Added By: Leong Vai Long at: 5/14/2014 10:46:46 PM    

Hi Dennis,

1. Is it possible to change the ASPXGridLookup with the ASPXDropDownEdit? This is the link http://blog.zerosharp.com/three-ways-to-store-a-list-of-currency-codes-in-xaf/#disqus_thread, but this example use the string, how to convert it to enum?
2. How to contact your ASP.NET team to implement my task with the ASPXGridLookup?

Thanks.

Added By: Dennis (DevExpress Support) at: 5/15/2014 7:07:00 AM    

@Leong:

A1: Sure, you are free to implement your own custom PropertyEditor based on any control you want.
A2: You can submit a new question through https://www.devexpress.com/Support/Center/Question/Create and specify the ASP.NET Web Forms platform and ASPxGridView and Editors Suite as a product. In the new ticket describe what you have implemented so far, attach a small non-XAF sample where you tried to customize the ASPxDropDownEdit control and also describe your requirements in detail. Before doing this, you may want to check out the documentation on our ASP.NET Web Forms controls and also corresponding demos. To effectively search our knowledge base, documentation and examples, you may find our Search Engine helpful.

 

Added By: Dennis (DevExpress Support) at: 5/19/2014 6:56:03 AM    

@Leong:

I have modified the Web version of this custom editor to support localized values. Please refer to the attachment.

Added By: MohammedFarooq at: 5/16/2016 7:28:54 AM    Hi Dennis,

How can i read the Text value that is displayed in the editor? Added By: Dennis (DevExpress Support) at: 5/16/2016 7:56:25 AM    

@MohammedFarooq: There are different properties like EditValue/Text/Value in underlying WinForms and ASP.NET controls. Would you please elaborate a bit more on how you are going to reuse these display values (please submit a separate ticket via the https://www.devexpress.com/Support/Center/Question/Create service for that purpose)?

Added By: Tony Tadros at: 6/10/2016 11:46:04 AM    Hello Devexpress,

trying to use your example but i am having an issue

if the combobox opened and closed without changing the value the save object is marked as changed

is there is a way to avoid the extra warning specially the user did not change the value

Regards
Tony

How to process authenticated requests on the OData service

$
0
0

This example demonstrates how to process authenticated requests on the OData service. The main idea is to override the DataService.OnStartProcessingRequest method and implement authenticated logic in it.

To access this service, use the following credentials:

UserName: John
Password: qwerty

See also:
OData and Authentication – Part 6 – Custom Basic Authentication
Salt (cryptography)
How to send authenticated requests to the OData service
How to: Use the XPO OData V3 Service

Question Comments

Added By: Jay Patel 15 at: 9/24/2013 11:33:27 AM    

I was wondering why this project is not compatible with Visual Studios Ultimate 2010? Thanks

Added By: Joseph Tang 3 at: 10/10/2013 7:57:30 AM    

I used your code with the modification that it would check the AD for authentication. It works. However, it always popup the login window for entering the username and password.

Added By: Pedro Coutinho 1 at: 11/28/2013 3:22:33 AM    

How can i get the userinfo from the database?

Added By: Pedro Coutinho 1 at: 11/29/2013 7:09:31 AM    

How can i retrieve this users from a database?

Added By: George Yoder at: 1/25/2014 1:19:44 PM    

How would you do authentication with sql membership provider????

Added By: Enderson Salas at: 7/29/2014 4:26:35 PM    

This example no compile in  Visual Studio 2013  because some assembly references are missing.

Added By: Nikolai (DevExpress Support) at: 7/30/2014 4:23:50 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T135174: E4403 is not compiled in Visual Studio 2013. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: PedroPerez at: 7/1/2015 7:56:29 AM    

Hello Dev express team,

Can you please explain me how to get my the user information from our DB, we use  The Profile provider in ASP.NET Membership & Users, and how to integrated to this Authentication process?

************************* YOUR SAMPLE CODE************************
namespace MyDataService {     
public class CustomBasicAuth {          
class UserInfo {             
public string Name { get; set; }             
public string PasswordHash { get; set; }             
public string[] Roles { get; set; }         }          
static UserInfo[]
Users = new[] {             new UserInfo {                 
Name = "John",                 
PasswordHash = "F3U89ry4+MMXyqbbT90tcs18J5Y=",                 
Roles = new[] { "User", "Admin" }             }         };
************************************************************************
My Tables:

aspnet_Users:
UserID
UserName

aspnet_Membership:
UserID
Password (encripted)

aspnet_Roles:
RoleID
RoleDescripcion

aspnet_UsersInRoles:
UserID
RoleID

Regards
Pedro Perez

Added By: Nikolai (DevExpress Support) at: 7/2/2015 1:27:09 AM    

Hello Pedro,

To process your recent post more efficiently, I created a separate ticket on your behalf: T262586: How to select users from DB in authenticated data service. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Luong Tu at: 11/29/2015 7:24:29 PM    

When I debug this webservice and go to this link http://localhost:65443/MyDataService.svc. It throw an error 'Invalid login or password'. How can I access this service? I don't know how to use UserName: John, Password: qwerty you gave me.

Added By: Nikolai (DevExpress Support) at: 11/29/2015 11:51:43 PM    Hi,

This example is intended for  How to send authenticated requests to the OData service. It demonstrates how to send user credentials to the server side.Added By: Hari Setyawan 2 at: 6/14/2016 3:25:21 AM    How do you connect the authentication with the view html and js and also the data in the database?

How to represent an enumeration property via a drop-down box with check boxes

$
0
0

Scenario:

There is an enumeration type decorated with the FlagsAttribute, which means that an enumeration can be treated as a set of flags. There is also a property of this enumeration type inside the business class. This is helpful when several predefined enumeration values can be stored using this data property. In the UI, this data property is usually represented via an editor with multiple check boxes:


Steps To Implement:

Since there is no standard  PropertyEditor for enumerations that would allow you to store several values at once, it is common to implement custom Property Editors for this task. A custom PropertyEditor will take data property value as its input and represent it in the UI using a custom visual control. There will be one PropertyEditor for WinForms (based on the CheckedComboBoxEdit control from the XtraEditors Suite) and one for ASP.NET (based on the ASPxGridLookup control from our ASPxGridView and Editors Suite), because there is no platform-agnostic way to achieve such a look and feel.


Consider following the steps below to implement and use editors from this example in your project.
1. Implement an enumeration type decorated with the FlagsAttribute as shown in the E689.Module\BusinessObjects\DemoObjects.xx file;
2. Copy the E689.Module.Win\Editors\EnumPropertyEditorEx.xx file into YourSolutionName.Module.Win project;
3. Copy the E689.Module.Web\Editors\ASPxEnumPropertyEditorEx.xx file into YourSolutionName.Module.Web project;
4. Build the solution and invoke the Model Editor for the ModelDesignedDiffs.xafml files from YourSolutionName.Module.Win and YourSolutionName.Module.Web projects.

5. Locate the BOModel | YourClassName | Members | YourEnumerationProperty node and set its PropertyEditorType property to the corresponding EnumPropertyEditorEx types.

 

See Also:

Implement Custom Property Editors
How to represent a enumeration property via radio buttons or check boxes on the Web

Question Comments

Added By: Pawel Botwina at: 7/6/2013 1:11:36 AM    

Hello,

How can I filter by flags enum property in the server mode? I mean filtering the ListView by AutoFilterRow.

Added By: Alex Kads at: 4/4/2014 2:35:40 PM    

would that same code for WEB

Added By: Dennis (DevExpress Support) at: 4/8/2014 12:45:41 AM    

@Alex: While we do not have a ready Web version of this example, you may find the code from the E1807 example helpful. Thanks.

Added By: Anatol (DevExpress Support) at: 4/9/2014 9:32:02 AM    

Web version is added.

Added By: Leong Vai Long at: 5/14/2014 3:22:04 AM    

Hi, I had try this method for the XAF web version. The question is how i want to use the XAF Display Name to show in the lookup? bcos I only see the enum values.
Thanks.

Added By: Dennis (DevExpress Support) at: 5/14/2014 9:09:47 AM    

@Leong: This particular functionality is not implemented in this example solution. You would need to modify the E689.Module.Web.Editors.EnumPropertyEditorEx class to achieve this. While we do not have a ready sample, feel free to contact our ASP.NET team on how to implement your task with the ASPxGridLookup component used in this example. Once you receive a solution for this component, it can be easily integrated in XAF.

Added By: Leong Vai Long at: 5/14/2014 10:46:46 PM    

Hi Dennis,

1. Is it possible to change the ASPXGridLookup with the ASPXDropDownEdit? This is the link http://blog.zerosharp.com/three-ways-to-store-a-list-of-currency-codes-in-xaf/#disqus_thread, but this example use the string, how to convert it to enum?
2. How to contact your ASP.NET team to implement my task with the ASPXGridLookup?

Thanks.

Added By: Dennis (DevExpress Support) at: 5/15/2014 7:07:00 AM    

@Leong:

A1: Sure, you are free to implement your own custom PropertyEditor based on any control you want.
A2: You can submit a new question through https://www.devexpress.com/Support/Center/Question/Create and specify the ASP.NET Web Forms platform and ASPxGridView and Editors Suite as a product. In the new ticket describe what you have implemented so far, attach a small non-XAF sample where you tried to customize the ASPxDropDownEdit control and also describe your requirements in detail. Before doing this, you may want to check out the documentation on our ASP.NET Web Forms controls and also corresponding demos. To effectively search our knowledge base, documentation and examples, you may find our Search Engine helpful.

 

Added By: Dennis (DevExpress Support) at: 5/19/2014 6:56:03 AM    

@Leong:

I have modified the Web version of this custom editor to support localized values. Please refer to the attachment.

Added By: MohammedFarooq at: 5/16/2016 7:28:54 AM    Hi Dennis,

How can i read the Text value that is displayed in the editor? Added By: Dennis (DevExpress Support) at: 5/16/2016 7:56:25 AM    

@MohammedFarooq: There are different properties like EditValue/Text/Value in underlying WinForms and ASP.NET controls. Would you please elaborate a bit more on how you are going to reuse these display values (please submit a separate ticket via the https://www.devexpress.com/Support/Center/Question/Create service for that purpose)?

Added By: Tony Tadros at: 6/10/2016 11:46:04 AM    Hello Devexpress,

trying to use your example but i am having an issue

if the combobox opened and closed without changing the value the save object is marked as changed

is there is a way to avoid the extra warning specially the user did not change the value

Regards
Tony Added By: Dennis (DevExpress Support) at: 6/13/2016 1:58:28 AM    

@Tony: I've created a separate ticket on your behalf (T391277: E689 - How to avoid the save confirmation when opening a drop down without changing its value). It has been placed in our processing queue and will be answered as soon as we can.

ASPxGridView - Batch Editing - A simple implementation of an EditItemTemplate

$
0
0

This example demonstrates how to create a custom editor inside column's DataItem template when ASPxGridView is in Batch Edit mode. Since, ASPxGridView performs batch editing on the client side, we cannot process or pass values from editors placed inside templates on the server side. Thus, all processing will be performed on the client side. 


You can implement the EditItem template for a column by performing the following steps:

1. Specify column's EditItem template:

[ASPx]
<dx:GridViewDataColumnFieldName="C1"><EditItemTemplate>   <dx:ASPxSpinEditID="C1_spinEdit"runat="server"ClientInstanceName="C1spinEdit"Width="100%">   </dx:ASPxSpinEdit></EditItemTemplate></dx:GridViewDataColumn>


2. Handle grid's client-side BatchEditStartEditing event to set the grid's cell values to the editor. It is possible to get the focused cell value using the e.rowValues property:

[JScript]
       function Grid_BatchEditStartEditing(s, e){           var templateColumn = s.GetColumnByField("C1");           if(!e.rowValues.hasOwnProperty(templateColumn.index))               return;           var cellInfo = e.rowValues[templateColumn.index];            C1spinEdit.SetValue(cellInfo.value);           if(e.focusedColumn === templateColumn)                C1spinEdit.SetFocus();       }


3. Handle the BatchEditEndEditing event to pass the value entered in the editor to the grid's cell:

[JScript]
function Grid_BatchEditEndEditing(s, e){           var templateColumn = s.GetColumnByField("C1");           if(!e.rowValues.hasOwnProperty(templateColumn.index))               return;           var cellInfo = e.rowValues[templateColumn.index];            cellInfo.value = C1spinEdit.GetValue();            cellInfo.text = C1spinEdit.GetText();            C1spinEdit.SetValue(null);       }

 

4. The BatchEditRowValidating event allows validating the grid's cell based on the entered value:

[JScript]
function Grid_BatchEditRowValidating(s, e){           var templateColumn = s.GetColumnByField("C1");           var cellValidationInfo = e.validationInfo[templateColumn.index];           if(!cellValidationInfo)return;           var value = cellValidationInfo.value;           if(!ASPxClientUtils.IsExists(value) || ASPxClientUtils.Trim(value) === ""){                cellValidationInfo.isValid = false;                cellValidationInfo.errorText = "C1 is required";           }       }

 
5. Finally, handle the editor's client-side KeyDown and LostFocus events to emulate the behavior of standard grid editors when an end-user uses a keyboard or mouse:

[JScript]
var preventEndEditOnLostFocus = false;function C1spinEdit_KeyDown(s, e){           var keyCode = ASPxClientUtils.GetKeyCode(e.htmlEvent);           if(keyCode === ASPx.Key.Esc){               var cellInfo = grid.batchEditApi.GetEditCellInfo();                window.setTimeout(function(){                    grid.SetFocusedCell(cellInfo.rowVisibleIndex, cellInfo.column.index);               }, 0);                s.GetInputElement().blur();               return;           }           if(keyCode !== ASPx.Key.Tab && keyCode !== ASPx.Key.Enter)return;           var moveActionName = e.htmlEvent.shiftKey ? "MoveFocusBackward" : "MoveFocusForward";           if(grid.batchEditApi[moveActionName]()){                ASPxClientUtils.PreventEventAndBubble(e.htmlEvent);                preventEndEditOnLostFocus = true;           }       }function C1spinEdit_LostFocus(s, e){if(!preventEndEditOnLostFocus) grid.batchEditApi.EndEdit(); preventEndEditOnLostFocus = false;}

 
See Also:
GridView - Batch Editing - A simple implementation of an EditItem template 


How to: Implement a Security System User Based on an Existing Business Class (XPO)

How to create a complex layout of dock panels

$
0
0

This example shows how to create a complex layout of dock panels, by combining the panels into LayoutGroups. The following Layout Groups are created:
- RootGroup (arranges LayoutGroup1 and LayoutGroup3 horizontally)
- LayoutGroup1 (arranges LayoutGroup2 and TabbedGroup vertically)
- LayoutGroup2 (arranges three LayoutPanels horizontally)
- LayoutGroup3 (arranges two LayoutPanels vertically).

Question Comments

Added By: Matthew Fritz 4 at: 6/9/2016 4:40:17 AM    is this sample broken?Added By: Ilya (DevExpress Support) at: 6/9/2016 7:52:06 AM    Hi Matthew,
I've created a separate thread regarding the issue: The project from E1663 doesn't work. Let's continue our discussion there.

How to: Load a PDF Document from a Stream

$
0
0

This example shows how to load a document from the Stream using the DocumentViewerControl.DocumentSource property. The stream is obtained from the assembly resources:

[C#]
Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName);

Note the input stream will not be closed until the control uses the loaded document (PdfViewerControl.DetachStreamOnLoadComplete is set to false by default). This allows the PDF Viewer to render a large PDF file quickly.


See also:
Loading a Document

Viewing all 7205 articles
Browse latest View live