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

How to use SplashScreenService

$
0
0


Our SplashScreenService provides the capability to show the progress of certain processes in your application. This example illustrates how you can add SplashScreenServices to your application and show them when necessary.

 

In the current implementation, there are two SplashScreenServices added to the main page: DefaultSplashScreen and ProgressBarSplashScreen. The first service uses the default splash screen appearance, which shows a progress ring when the ShowSplashScreen method is called. The second service is defined with ProgressBarSplashScreenView in its SplashScreenType property. This view contains a ProgressBar and a caption that allow you to show additional information. ProgressBarSplashScreenView is available out of the box in the DevExpress.Mvvm.UI namespace.

 

Note that SplashScreenService works only when the DXFrame or HamburgerMenuFrame is used.


Simple IListServer implementation

$
0
0

This simple IListServer interface implementation was made to illustrate interface members: what data should be passed in arguments and what result these members are expected to produce.

This is a basic implementation that doesn't demonstrate the efficiency of server mode data sources. To make all the grid functionality work, it is necessary to implement the remaining methods of this interface and modify methods implemented in this sample to use features of the actual underlying data source. For an example of a complete implementation of this interface, refer to the source code of the built-in server mode components:
c:\Program Files (x86)\DevExpress 16.1\Components\Sources\DevExpress.Data\DataController\ServerMode\
c:\Program Files (x86)\DevExpress 16.1\Components\Sources\DevExpress.Xpo\DevExpress.Xpo\ServerModeGridSource.cs
c:\Program Files (x86)\DevExpress 16.1\Components\Sources\DevExpress.Xpf.Core\DevExpress.Xpf.Core\Editors\Controls\LookUp\DataLayer\DataController\ServerMode\

Question Comments

Added By: paul schwartzberg 1 at: 9/27/2016 1:20:57 AM    You write:

     "You can get an example of full implementation in the source code of the default server mode components."

Where do i find the "the source code of the default server mode components" to get a full IListServer Implementation?

Thanks,
Paul Added By: Michael (DevExpress Support) at: 9/27/2016 4:33:50 AM    @Paul: I have updated the example description with the necessary information. Should you have additional questions, please submit a new ticket.

Added By: David Lemieux at: 11/23/2016 6:22:59 AM    How long before IListServer interface makes its appearance inside the documentation?Added By: Michael (DevExpress Support) at: 11/23/2016 8:07:50 AM    @David: I cannot provide you with an estimate. As you may notice by lookng at the list of versions of this example, the API is constantly evolving. We're not yet ready to fix it.

How to edit multiple values in GridView at the same time

$
0
0


This example demonstrates how to provide the capability to an end-user to edit multiple selected cells values at once:

Question Comments

Added By: Gwan jung at: 6/13/2013 6:28:08 PM    

this code worked perfectly except columns filter exist...

Case :
1. column[0] has filter string "mike"
2. row[0][0] ~ row[10][0] has "mike" value
3. multi select row[1][0] ~ row[4][0]
4. click one of this cells again, delete mike

in that case, mulit edit function work strange....

Added By: Keite Tuane Carvalho at: 2/5/2015 10:15:42 AM    

How I can save these records changed in the database?

Added By: Svetlana (DevExpress Support) at: 2/5/2015 12:45:43 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T205671: How to save changes from a grid to a data base. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Christian Riis at: 11/24/2016 6:37:35 AM    If you mark multiple cells to change them all, then type in the same text as already in the focused cell, no cells in the selection are changed. Can you fix this?Added By: Alexey Z (DevExpress Support) at: 11/24/2016 8:25:09 AM    

Hello,

I've created a separate ticket on your behalf (T455008: E2779 - If you mark multiple cells to change them all, then type in the same text as already in the focused cell, no cells in the selection are changed). It has been placed in our processing queue and will be answered shortly.

How to filter column popup items like in MS Excel

$
0
0

DXGrid has the built-in ShowAllTableValuesInCheckedFilterPopup property that allows enabling the following mode:
- If the current column is not filtered, the filter dropdown displays only those items that meet the grid's filter condition.
- Otherwise, all data source items are displayed to simplify the process of the grid filter correction.


If this functionality is insufficient, and filtering dropdown items when the current column is filtered is required, use the approach demonstrated in this example.

Dropdown items can be filtered in the DataViewBase.ShowFilterPopup event handler. To maintain items that were filtered by the current column and remove items filtered by other grid columns, perform the following steps:

1. Exclude the current column from the grid's filter. In this example, this operation is performed by the FilteringBehavior.RemoveColumn method.

2. Filter items with the resulting filter criteria. This task is accomplished using our internal ExpressionEvaluator class.

[C#]
ExpressionEvaluatorevaluator=newExpressionEvaluator(TypeDescriptor.GetProperties(source.FirstOrDefault()),criteria);IEnumerable<object>filteredCollection=evaluator.Filter(source).OfType<object>();

Important:
As ExpressionEvaluator receives standard property descriptors in this example, this makes this example incompatible with the DisplayText filter mode and custom filtering.

3. Update the e.ComboBoxEdit.ItemsSource property based on the filtering results.

Question Comments

Added By: PraveenKumar Kuppuswamy at: 11/24/2016 8:34:51 PM    Hi

The Below solution is not working for me.

Thanks
Praveen Added By: Andrey Marten (DevExpress Support) at: 11/24/2016 10:42:27 PM    


Hello,

I've created a separate ticket on your behalf (T455126: The approach from T156289 works incorrectly). It has been placed in our processing queue and will be answered shortly.

Thanks,
Andrey

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.

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.

Updating a Grid datasource from a separate thread

$
0
0

This example shows how to properly update the Grid's underlying data source from a background thread, and avoid possible synchronization problems.

See Also:
Can I avoid the ArgumentOutOfRangeException when updating the Grid's data

Question Comments

Added By: Rongchen Jia at: 8/22/2013 12:51:30 AM    

hi, i can see that you are updating a copy of the datasource and then rebind grid's datasouce to the new update.
I am wondering wont it be more efficient instead of doing
gridControl1.BeginInvoke(new MethodInvoker(delegate { gridControl1.DataSource = clone; }));
we do
gridControl1.BeginInvoke(new MethodInvoker(delegate { FillData(data, deleting); deleting=!=deleting}));

is there any problem in updating the DataTable data object directly on UI thread?

Added By: Gosha (DevExpress Support) at: 8/30/2013 10:50:31 AM    

Hi Rongchen,

The main idea of updating the Grid data source from a background thread is that a long operation does not block the UI thread. If you update the data source in the UI thread, it will be blocked while the data source is being updated. So, there is no benefit in this approach.

Added By: Nikesh Parakh at: 11/15/2014 7:58:21 AM    

I am using same  code which you have mention below using thread but still mine
View_ShownEditor(object sender, EventArgs e) is not calling which I am clicking on grid cell.

Added By: Nikita (DevExpress Support) at: 11/16/2014 11:58:23 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T174225: GridControl - The editor is not shown when a data source is updated from a background thread . This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: sevak dhanjaya at: 11/25/2016 6:48:05 AM    This example is working but logic is not good. 
1) Suppose if value of one or two cells change then why need to clone full datasource and change again. If this value keep changing for example last price then clone and again and again change datasource is very much resource consumption.
2) Background thread has datatable. Then how background thread use gridcontrol object. Why pass all gridcontrol reference to background thread.
3) Previous version was working by using DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection. But now this method is obsolete.
Can you please change program, remove clone option and don't pass gridcontrol to another thread. So this example will be very useful.

How to bind the SchedulerControl to the ObservableCollection using the MVVM pattern

$
0
0

This example illustrates how to bind SchedulerControl appointment and resource storages to ObservableCollection instances in the context of the basic MVVM implementation. Custom appointment and resource objects are represented by the ModelAppointment and ModelResource class instances. The SchedulerViewModel class exposes the collections of these objects. Finally, the corresponding view model properties are specified in binding expressions in the MainWindow.xaml markup file.

In addition, this example illustrates how to access the underlying data objects of a certain appointment. Note that the PersistentObject.GetSourceObject Method is used for this purpose.

Note: Data formats, in which the ModelResource.Color and ModelAppointment.ResourceId property values are specified in the SchedulerViewModel.AddTestData() method, are described in the ResourceStorageBase.ColorSaving Property and How to: Enable Multi-resource Appointments help sections correspondingly.

Question Comments

Added By: Brian Morris 01 at: 4/4/2013 1:54:27 PM    

This example has been very helpful...however, I would really like to move the ObservableCollection to the code behind file, "MainWindow.xaml.cs". When do this, something breaks the binding with Appointments. I have moved all the logic from the SchedulerViewModel.cs file into the "MainWindow.xaml.cs" file and now when I run the project the Scheduler is blank. How can one bind to an ObservableCollection in the code behind file?

How to bind a Scheduler to data using the Entity Framework Database First approach using the MVVM pattern

$
0
0

This example illustrates how to implement a scheduling application implementing the MVVM pattern (see Model View ViewModel). In this example, a SchedulerControl is bound to data using Entity Framework Database First approach.

Question Comments

Added By: Marcin Sulecki at: 4/29/2015 11:47:12 PM    

IMHO, simpler solution is use to EventToCommand class:

 <dxsch:SchedulerControl.Storage>
                      <dxsch:SchedulerStorage>
                          <dxmvvm:Interaction.Behaviors>
                              <dxmvvm:EventToCommand EventName="AppointmentsInserted" Command="{Binding AppointmentsAddedCommand}" />
                              <dxmvvm:EventToCommand EventName="AppointmentsChanged" Command="{Binding AppointmentsModifiedCommand}" />
                              <dxmvvm:EventToCommand EventName="AppointmentsDeleted" Command="{Binding AppointmentsDeletedCommand}" />

                          </dxmvvm:Interaction.Behaviors>

 </dxsch:SchedulerControl.Storage>

Added By: Oleg (DevExpress Support) at: 4/30/2015 3:35:16 AM    

You are absolutely correct, Marcin!
An alternative approach to bind the SchedulerControl's event with a specific command of the View Model is to use the dxmvvm:EventToCommand class.
Thank you for posting your solution here.


TreeList - How to implement node reordering

$
0
0

Currently, the TreeList extension only allows node insertion (a modification of the current node's parent node). 
This example demonstrates how to implement node reordering and also provides the implementation of custom reorder/insert icons. 

Here is how you can implement this scenario:
- Get all of the sibling nodes of the node that is currently being dragged and calculate its bounds in the client-side ASPxClientTreeList.StartDragNode event handler.
- Ensure that the mousemove handler is attached to the document object. In the client-side mousemove event handler, check whether it is possible to reorder/insert nodes and change the reorder/insert image.
- In the client-side ASPxClientTreeList.EndDragNode event handler, get the e.htmlEvent object and see if reordering is possible. If so, set the e.cancel property to false and perform a custom callback to the TreeList extension.


In order to check whether it is possible to reorder nodes, iterate through the neighboring nodes' bounds you've saved in the StartDragNode event handler. In order to get the current cursor position, use the ASPx.Evt.GetEventX and ASPx.Evt.GetEventY methods. 

In order to get the drag & drop image, use the GetDragAndDropNodeImage method of the ASPxClientTreeList object. Note that this is private API, so we do not guarantee that we will not change it in our further releases. Even though in the case of the GetDragAndDropNodeImage method it is hardly possible that we will change it, I still encourage you to test this solution while upgrading to the next releases.

 

Node reorder functionality limitation: It is not possible to keep a custom order of the nodes when the control is sorted by any column. Thus, it is necessary to disable the sorting functionality via the TreeListSettings.SettingsBehavior.AllowSort property.

How to create a drill-through report that supports backward navigation to a primary report

$
0
0

This example illustrates how to create a drill-through report and display it in the same document viewer without creating addition Print Preview forms and also implement a backward navigation from a child report to a parent report.

To show a child report instead of a parent one in the DocumentViewer control, it is necessary to assign an instance of the child report to the DocumentViewer.DocumentSource property.

For this, a custom IDrillThroughReportHelper interface is implemented. The interface contains the DocumentViewer instance where the child report should be loaded. The interface also contains a property that stores an instance of the parent report. This property is used to provide switching from the child report to the parent. Each report is inherited from the IDrillThroughReportHelper interface to provide the required functionality.

To switch from a parent report to a child report, the example uses an approach described in the How to: Create a Drill-Through Report article.

LookUpEdit - How to Customize the embedded grid control

$
0
0

This example shows how to customize the DXGrid Control displayed within the Lookup editor's popup window.

Note: the embedded DXGrid name must be set to PART_GridControl.

Question Comments

Added By: D Kimzey at: 4/10/2013 1:40:57 PM    

In the XAML below, where does ProductName, UnitPrice and Quantity come from? What is the datasource?

Added By: Andrey K (DevExpress Support) at: 1/20/2015 12:23:34 AM    Hello,

We accidentally discovered that your initial post was out of scope of our Support Center for a long time. Please accept our sincere apologies for not responding in a timely manner.I've created a separate ticket on your behalf regarding the task you've mentioned in your message to process it more efficiently: T198598: What is the E2648 example datasourceIf this task is still important for you, please find a couple of minutes to refer to that thread.

Thanks,
AndreyAdded By: JRelyea at: 11/27/2016 7:19:07 PM    This article fixed my issue where the DataGrid selection was not being reflected in the parent LookUpEdit. I was missing AutoPopulateColumns="False" in the LookUpEdit. 

If all columns were displayed by removing AutoGenerateColumns="None" in the datagrid, then all columns of the model were displayed and the LookUpEdit was updated when a DataGrid row was selected

BUT If only some of the columns were displayed by adding AutoGenerateColumns="None" in the DataGrid, then the right fields of the model were displayed and the LookUpEdit was never updated when a DataGrid row was selected.

This example let me find the AutoPopulateColumns property and I'm moving on now.

Thank youi

 Added By: Kirill (DevExpress Support) at: 11/28/2016 12:37:32 AM    I'm happy to hear that this example helped you.

How to implement the master detail GridView with editing capabilities

$
0
0

This example illustrates how to implement the master detail GridView with editing capabilities.
Perform the following steps to define the master-detail layout:
1) Define both master and detail GridView settings within separate PartialView files (see the Using Callbacks);
2) Set the master grid's SettingsDetail.ShowDetailRow property to "True";
3) Define the master grid's DetailRow content via the SetDetailRowTemplateContent method and render the detail grid's PartialView inside.

Note:
Values passed in a detail grid's CallbackRoute must have a unique name and must not replicate any other names on a page: Q577974: GridView - "The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32'" error occurs when canceling editing in the detail GridView


See also:
GridView - Advanced Master-Detail View
A simple example of master-detail grids with editing capabilities

Question Comments

Added By: Wilson Vargas at: 10/20/2012 12:08:04 PM    

This sample not compile!

 settings.DataBinding = (sender, e) => {
            ((MVCxGridView)sender).ForceDataRowType(typeof(DevExpress.Razor.Models.Person));

Added By: WillAutio at: 3/24/2014 1:37:52 PM    

Excellent - just what I needed!

Added By: Paul Astro at: 8/27/2014 12:21:12 PM    

Hello Support,

Is there a ASP.NET version for this exact same example?  Please supply URL link......  thanks.

Added By: Anthony (DevExpress Support) at: 8/27/2014 11:49:39 PM    Hello,

Please refer to the A simple example of master-detail grids with editing capabilities example.Added By: venu koneru at: 4/15/2015 12:06:30 PM    

The below code is the master page partial view
@{
var grid = Html.DevExpress().GridView(settings => {
       settings.Name = "GridViewptconfig";
       settings.CallbackRouteValues = new { Controller = "PTTEST", Action = "GridViewPartialptconfig" };

       //settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "PTTEST", Action = "GridViewPartialptconfigAddNew" };
       //settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "PTTEST", Action = "GridViewPartialptconfigUpdate" };
       //settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "PTTEST", Action = "GridViewPartialptconfigDelete" };
       //settings.SettingsEditing.Mode = GridViewEditingMode.EditFormAndDisplayRow;
       //settings.SettingsBehavior.ConfirmDelete = true;

       //settings.CommandColumn.Visible = true;
       //settings.CommandColumn.ShowNewButton = true;
       //settings.CommandColumn.ShowDeleteButton = true;
       //settings.CommandColumn.ShowEditButton = true;
       

settings.KeyFieldName = "ptConfigId";                

settings.SettingsPager.Visible = true;
settings.Settings.ShowGroupPanel = false;
settings.Settings.ShowFilterRow = false;
settings.SettingsBehavior.AllowSelectByRowClick = false;
       settings.SettingsBehavior.AllowSort = false;

       settings.SettingsDetail.ShowDetailRow = true;
       settings.SettingsDetail.AllowOnlyOneMasterRowExpanded = true;
       settings.SetPreviewRowTemplateContent(c =>
               Html.RenderAction("GridViewPartialResult",
new { MasterId = DataBinder.Eval(c.DataItem, "ptConfigId") }));

               settings.Columns.Add("ptConfigId");    
               settings.Columns.Add("ptProductId");                
settings.Columns.Add("freq");
settings.Columns.Add("volt");
settings.Columns.Add("sens");
settings.Columns.Add("ppk");
});
if (ViewData["EditError"] != null){
       grid.SetEditErrorText((string)ViewData["EditError"]);
   }
}
@grid.Bind(Model).GetHtml()

Added By: venu koneru at: 4/15/2015 12:10:04 PM    

The below code is the detail page view
-------------------------------------------------

@{
var grid = Html.DevExpress().GridView(settings => {
       settings.Name = "GridViewResult";
       settings.CallbackRouteValues = new { Controller = "PTTEST", Action = "GridViewPartialResult" };

settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "PTTEST", Action = "GridViewPartialResultAddNew" };
       settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "PTTEST", Action = "GridViewPartialResultUpdate" };
       settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "PTTEST", Action = "GridViewPartialResultDelete" };
       settings.SettingsEditing.Mode = GridViewEditingMode.EditFormAndDisplayRow;
       settings.SettingsBehavior.ConfirmDelete = true;

settings.CommandColumn.Visible = true;
       settings.CommandColumn.ShowNewButton = true;
       settings.CommandColumn.ShowDeleteButton = true;
       settings.CommandColumn.ShowEditButton = true;

settings.KeyFieldName = "ptConfigId";

settings.SettingsPager.Visible = true;
settings.Settings.ShowGroupPanel = true;
settings.Settings.ShowFilterRow = true;
settings.SettingsBehavior.AllowSelectByRowClick = true;

       settings.SettingsDetail.MasterGridName = "GridViewptconfig";

settings.Columns.Add("ptConfigId");
settings.Columns.Add("fesample");
settings.Columns.Add("feresult");
settings.Columns.Add("nfesample");
settings.Columns.Add("nferesult");
settings.Columns.Add("sssample");
settings.Columns.Add("ssresult");
});
if (ViewData["EditError"] != null){
       grid.SetEditErrorText((string)ViewData["EditError"]);
   }
}
@grid.Bind(Model).GetHtml()

Added By: venu koneru at: 4/15/2015 12:10:34 PM    

Are the Master detail code correct.

Added By: Alessandro (DevExpress Support) at: 4/15/2015 12:26:42 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T231079: GridView - Master-Detail implementation. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Jack Lakes at: 11/28/2016 3:46:15 PM    Just tried to implement this project, however, the following does not work because it can't find it.

using DevExpress.Razor.Models;

I tried to add it to my reference, but I can't find a devexpress razor file anywhere.  Can you help me understand what I am doing wrong?  -- Thanks

How to export GridView data to different text formats

$
0
0

This example is standalone implementation of the online Grid View - Exporting Data demo.
It illustrates how to export the GridView 's content to several rich text formats via the ExportTo*** methods.

This example is an illustration of the KA18639: How to export GridView rows and keep end-user modifications (such as sorting, grouping, filtering, selection) KB Article. Refer to the Article for an explanation.

Please note the following key moments:
- The GridView Extension should be defined via a separate PartialView without any additional tags (see the Using Callbacks help topic for more information);
- The GridView's PartialView should be wrapped within a form in order to apply the client layout state (sorting, filtering, etc.);
- An export trigger should submit this form to the corresponding Controller Action (i.e., make a POST request);
- The GridViewSettings (especially the Name property) should be the same in PartialView and Controller;
- The datasouce/Model should be the same in PartialView and Controller.

Question Comments

Added By: Nurhak Kaya at: 9/4/2012 7:58:55 AM    

Really good! Thanks a lot!

Added By: Steven Jansick at: 7/11/2014 11:44:57 AM    

Does this work when binding with BindToCustomData?

I have verified that all of the Conditions have been met but when I export, it is not maintaining the Grouping Order.  Do you have any recommendations?

Added By: Mike (DevExpress Support) at: 7/14/2014 12:05:58 AM    

Hello,

To process your recent post more efficiently, we copied it to a separate ticket created on your behalf: T128968: GridView - Export Data when using BindToCustomData method.
This ticket is currently in our processing queue. We will post to it as soon as we have any updates.

Added By: Qasim Sarwar at: 11/28/2016 5:48:37 PM    Actually, I can Export to excel what I need is to filter grid and based on the result I want to export to excel,
How I can send filter parameter to excel export function.

Here is my  Button Code .cshtml view


@using (Html.BeginForm("ExportExcel", "Dataset", new { datasetID = Convert.ToInt64(ViewContext.RouteData.Values["datasetID"]) }))
{
    Html.DevExpress().Button(settings =>
    {
        settings.Name = "btnExportDatasetData";
        settings.Width = 100;
        settings.Text = "Export to XLS";
        settings.UseSubmitBehavior = true;
        settings.Images.Image.IconID = IconID.ExportExporttoxls16x16office2013;
    }).GetHtml();
}

Here is my Grid Code cshtml, what I want is to take parameters from grid Filter and pass it to my Controller

@Html.DevExpress().GridView(settings =>
{
    settings.Name = "DatasetDataGrid";
    settings.CallbackRouteValues = new { Controller = "Dataset", Action = "DatasetDataBindingPartial", datasetID = Convert.ToInt64(ViewContext.RouteData.Values["datasetID"]) };


    settings.CustomBindingRouteValuesCollection.Add(GridViewOperationType.Paging, new { Controller = "Dataset", Action = "DatasetDataBindingPaging" });
    settings.CustomBindingRouteValuesCollection.Add(GridViewOperationType.Sorting, new { Controller = "Dataset", Action = "DatasetDataBindingSorting" });
    settings.CustomBindingRouteValuesCollection.Add(GridViewOperationType.Filtering, new { Controller = "Dataset", Action = "DatasetDataBindingFiltering" });

i want to put here Condition if user click on button then it take filter parameter, otherwise won't.


    //if (settings.AfterPerformCallback != null)


    {
        settings.CustomBindingRouteValuesCollection.Add(GridViewOperationType.Filtering, new { Controller = "Dataset", Action = "ExportExcel" });
    }


    //settings.ClientSideEvents.EndCallback = "";


    settings.Width = Unit.Percentage(100);
    settings.Styles.Cell.CssClass = "CellsEllipsis";
    settings.Settings.HorizontalScrollBarMode = ScrollBarMode.Visible;


    settings.SettingsPager.PageSize = 50;
    settings.SettingsPager.PageSizeItemSettings.Visible = true;
    settings.SettingsPager.PageSizeItemSettings.Items = new string[] { "10", "20", "50", "100" };


    settings.Settings.ShowFilterRow = true;
    //settings.Settings.ShowFilterBar = GridViewStatusBarMode.Visible;


    settings.Columns.Add(col =>
    {
        col.FieldName = "FactID";
        col.Caption = "Fact ID";
    });


    if (Model != null && Model.Columns != null)
    {
        foreach (GridViewColumnState column in Model.Columns)
        {
            if (column != null)
            {
                if (column.FieldName != "FactID")
                {
                    settings.Columns.Add(column.FieldName);
                }
            }
            settings.Columns[settings.Columns.Count - 1].HeaderStyle.Font.Bold = true;
            settings.Columns[settings.Columns.Count - 1].Width = Unit.Pixel(150);
        }
    }


    settings.HtmlDataCellPrepared = (sender, e) =>
    {
        if (e.CellValue != null)
        {
            e.Cell.ToolTip = e.CellValue.ToString();
        }
    };


    settings.ClientSideEvents.Init = "function(s,e) { s.PerformCallback(); }";
}).BindToCustomData(Model).GetHtml()

here is my Controller Action Method,



        public ActionResult ExportExcel(Int64 datasetID, GridViewFilteringState filteringState)
        {


            var viewModel = GridViewExtension.GetViewModel("DatasetDataGrid");
            viewModel.ApplyFilteringState(filteringState);


            var results = DatasetDataBindingCoreExcel(viewModel);
            


            DevExpress.Web.Mvc.GridViewSettings settings = new DevExpress.Web.Mvc.GridViewSettings();
            settings.Styles.Header.BackColor = System.Drawing.ColorTranslator.FromHtml("#1E76AE");
            settings.Styles.Header.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
            settings.Styles.AlternatingRow.Enabled = DevExpress.Utils.DefaultBoolean.True;
            settings.Styles.AlternatingRow.BackColor = System.Drawing.ColorTranslator.FromHtml("#D9E7FA");
            settings.SettingsExport.RenderBrick = (sender, e) =>
            {
                DevExpress.Web.GridViewDataColumn dataColumn = e.Column as DevExpress.Web.GridViewDataColumn;
                if (e.RowType == DevExpress.Web.GridViewRowType.Data &&
                    dataColumn != null &&
                    (dataColumn.FieldName.ToLower() == "iscurrent" || dataColumn.FieldName.ToLower() == "ispublished"))
                {
                    e.TextValue = e.Value == DBNull.Value ? "False" : (Convert.ToBoolean(e.Value) ? "True" : "False");
                }
            };


            //settings.Columns.Add("ProgrammeID");
            settings.Name = "datasetExport";
            
            DatasetModel obj = dsrepo.GetDatasetInfo(datasetID);
            settings.SettingsExport.FileName = String.Format("{0}_{1}_{2}", obj.Title, obj.Code, DateTime.UtcNow.ToShortDateString());


            //settings.CallbackRouteValues = new { Controller = "Exporting", Action = "ExportPartial" };
            //settings.Width = DevExpress.Web.Unit.Percentage(100);


            return Who.Xmart.Helpers.GridViewExportHelper.GridViewExport.ExportFormatsInfo[Helpers.GridViewExportHelper.GridViewExportFormat.Xlsx](settings, results);




            //return Who.Xmart.Helpers.GridViewExportHelper.GridViewExport.ExportFormatsInfo[Helpers.GridViewExportHelper.GridViewExportFormat.Xlsx](settings, dsrepo.GetDatasetData(datasetID));
        }







Added By: Jenny (DevExpress Support) at: 11/28/2016 10:10:20 PM    

Hello Qasim,

I've created a separate ticket on your behalf (T456166: GridView - How to export the filtered grid to excel). It has been placed in our processing queue and will be answered shortly.

DiagramControl - How to create custom shapes with connection points

$
0
0
The Diagram control supports a special language for defining shapes. The main element that contains shape description is ShapeTemplate. This element describes a shape contour and may contain several segments:
- Start. Specifies the start point
- Line. Defines a line with start and end points
- Arc. Defines an arc with start and end points

To specify connection points, use the ShapeTemplate.ConnectionPoints property.
Shapes may contain parameters. Parameters may be used to dynamically calculate an end point, row height, and other properties. To specify parameters, use the ShapeTemplate.Parameters property.
To register custom shapes, create a stencil with the DiagramStencil.Create method and pass it to the DiagramToolboxRegistrator.RegisterStencil method.


Note:Starting with version 16.1, it is recommended to use XML to describe custom shapes. If you prefer to use XAML instead, take a look at the following example: T381372 - DiagramControl - How to create custom shapes with connection points using XAML markup.
Question Comments

Added By: Piotr Migdalski 1 at: 1/15/2016 7:12:33 AM    

Hello,

Is possible to use in templates images (from resources)?

Added By: Alexander Ch (DevExpress Support) at: 1/18/2016 4:45:20 AM    Hi Piotr,

ShapeTemplates allow you to describe a shape using primitives like Line and Arc. Displaying an image in a shape is a separate feature, which we plan to introduce in future versions.

Thanks,
AlexAdded By: Craig Dunstan at: 4/3/2016 7:05:49 AM    Is there any ability to leverage Visio stencils - either by converting them directly or via an intermediary like SVG?Added By: Alexander Rus (DevExpress Support) at: 4/4/2016 3:00:41 AM    

Hi Craig,
To process your recent post more efficiently, I created a separate ticket on your behalf: T363463: How to use shapes from Visio in DiagramControl

Thanks,
Alexander

Added By: Lavande at: 5/12/2016 11:16:13 PM    Hi,

Would you please explain further on how to build the xaml like yours? I am wondering this file is created by hand or I can use some funtions to generate the file automatically?
Added By: Alexander Rus (DevExpress Support) at: 5/13/2016 12:41:05 AM    

Hi Shuang,
I've created a separate ticket on your behalf (T378595: Is there a tool to generate shape descriptions for DiagramControl ). It has been placed in our processing queue and will be answered shortly.

Thanks,
Alexander

How to implement excel style tree filtering in a filter popup

$
0
0

Starting with version 16.2, this functionality will be available out of the box. To enable it, you can set the ColumnView.OptionsFilter.ColumnFilterPopupMode property to ColumnFilterPopupMode.Excel.
If you wish to use it for only a specific column, set this property at the GridColumn level.

If you are using an earlier version of DevExpress controls, see the attached example that targets this earlier version.

This example demonstrates how to filter dates using a tree and select date ranges.


How to create complex custom controls (XRTreeList and XRGrid)

$
0
0

This example demonstrates how to create custom data-aware controls that have a complex structure. The example consists of two projects:
- DevExpress.XtraReports.CustomControls. Contains all classes and methods related to custom controls.
- CustomControlExample. This project is for testing the aforementioned custom controls. This project invokes End-User Report Designers and Print Previews for both controls.

Take special note of the following classes and methods when examining the CustomControls project:
1. XRTreeList and XRGrid. They are XRControl descendants and contain all required properties and methods related to their visual representation.
1.1. The XRControl.CreatePresenter method allows you to create different presenters for visualizing your control at runtime and design time.
1.2. The XRControl.WriteContentTo method generates the visual representation and passes it to the resulting document.
1.3. The XRControl.CollectAssociatedComponents method allows you to link external objects (data source information and other Component properties) to your control.
1.4. The XRControl.CopyDataProperties method is required to inform your control of how to clone data source related properties.
1.5. The XRControl.CreateCollectionItem method defines how to create new collection items in your control.
1.6. The XRControl.CreateStyles method is responsible for creating specific control styles.
1.7. The XRControl.CreateScripts method creates scripts specific for this control.

2. XRTreeListDesigner and XRGridDesigner. These classes describe the design-time behavior of corresponding controls.
2.1. The XRControlDesigner.GetFilteredProperties method determines what properties should be visible in the Property Grid.
2.2. The XRControlDesigner.RegisterActionLists method fills the XRControl smart tag with required actions.

3. XRTreeListRuntimePresenter and XRGridRuntimePresenter. These classes generate visual representation of your controls.
3.1. The XRControlPresenter.CreateBrick method creates a container brick for displaying the control content.
3.2. The XRControlPresenter.PutStateToBrick method generates inner content based on the current control state.


Important note: the VB.NET solution is for VS 2012 or newer, because it uses new operators that do not exist in VS 2010.

See also:
How to: Create a Numeric Label
How to: Create a Progress Bar Control
Question Comments

Added By: Mohsen Abo-Ghaly at: 11/29/2016 10:15:12 AM    Hello,

Thanks for the good/smart approach.

Can we use this code/approach with the version 2012 - 2.6?

Thanks
Mohsen

GridView - How to implement cascaded combo boxes in the EditForm

$
0
0

This example is an illustration of the KA18675: MVC ComboBox Extension - How to implement cascaded combo boxes KB Article. Refer to the Article for an explanation.

UPDATED:

Starting with v16.1, it's not necessary to define the second combo box using the MVCxGridViewColumn.SetEditItemTemplateContent method to enable callbacks.
Use a new API instead:
MVCxGridViewColumn.EditorProperties 
MVCxColumnComboBoxProperties 
GetComboBoxCallbackResult 
 
You can find detailed steps by clicking the "Show Implementation Details" link below.

Question Comments

Added By: Cankut at: 8/26/2016 7:03:22 AM    Thanks for this great demonstration , i've used this in my project, could you upgrade this by using three cascaded combo boxes like Country, City and Street in MVC?Added By: Artem (DevExpress Support) at: 8/26/2016 8:13:07 AM    Hi,

You're welcome! I see you've asked the same question in the Cascade three thread. We'll reply to you there as soon as possible. Please refer to it for further correspondence.Added By: Yerko at: 11/29/2016 11:53:06 AM    Will this approach also work in Batch Editing and Updating with "cell" edit mode? Added By: Nataly (DevExpress Support) at: 11/29/2016 11:58:27 AM    

Hello,

I've created a separate ticket on your behalf (T456582: GridView - How to implement cascading combo boxes in Batch Edit mode). It has been placed in our processing queue and will be answered shortly.

How to force a GridLookUpEdit's drop-down window to filter records based upon all visible columns using the "contains" condition against an entered string

$
0
0

This example shows how to create a GridLookUpEdit's descendant whose drop-down window will select records whose fields contain a specified sub-string. Don't forget to specify the RepositoryItemLookUpEditBase.DisplayMember property.

See Also:
How to force the GridLookUpEdit to filter rows and show only those that contain a specified sub-string at least in one of displayed columns

Question Comments

Added By: CAD IT S.p.A. at: 5/23/2015 8:49:59 AM    

good work
how can i add a checked column to multiselect row?

Added By: Andrew Ser (DevExpress Support) at: 5/25/2015 12:38:09 AM    Hello,
In order to better serve and track multiple questions in your inquiry, we have taken the liberty of separating the issues you addressed. Please refer to the GridLookUpEdit - Multi-selection with checkboxes ticket for further correspondence.Added By: Nima Vijayan at: 10/2/2015 11:01:03 PM    

Hello

I have a requirement to set focus to first item of filtered items and highlight the focused row of repositorygridlookupedit in blue, when the user start to type on the repository item. Now popup is displayed when user start to type for filtering, but focus is not set to any of the fitered item in dropdown(popup). Focus is set only when user press arrow key.
I am using CustomGridLookUpEdit ( as in below code).

Its very urgent. Any suggestions/ solution is valuable.
I am using Devexpress v12.2 version.

Thanks
Nima

Added By: Sasha (DevExpress Support) at: 10/5/2015 12:46:43 AM    

Hello Nima,

To process your recent post more efficiently, I created a separate ticket on your behalf: T296582: GridLookUpEdit - How to highlight the focused row in blue when the user start to type on the repository item. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: xiaoliang lee at: 11/29/2016 6:13:59 PM    Does anyone know how to put this control into ToolBox in Visual Studio?I Compiled this Control but couldn't find it in the Toolbox。Added By: Nadezhda (DevExpress Support) at: 11/29/2016 10:40:11 PM    

Hello,

I've created a separate ticket on your behalf (How to add a custom editor to the ToolBox ). It has been placed in our processing queue and will be answered shortly.

OBSOLETE ASPxGridView - How to create a composite key

$
0
0

This example demonstrates how to use the unbound column feature to construct a composite key field.

NOTE: Starting from v2009 vol 1, the ASPxGridView supports composite keys out-of-the-box: Support for the composite key is required
You can use semicolon-separated values, to specify multi-field keys: "column1[;columnx]". For example: "FirstName;LastName;Phone;BirthDate".

See Also:
How to modify data when a composite key is used

Question Comments

Added By: Nirmala G at: 11/29/2016 4:38:14 PM    I get an error if i do the same  " cannot convert nvrachar to Int" Added By: Stason (DevExpress Support) at: 11/29/2016 11:13:39 PM    

Hello,

Would you please describe the issue in greater detail? The ASPxGridBase.KeyFieldName property can be specified as a composite key if you need to use such a key in the grid.

How to create a hierarchical report

$
0
0

This example illustrates how to create a hierarchical tree-like report based on data stored in a flat table. Data must meet certain requirements. Two additional fields are necessary to build a tree structure. The first field must contain unique values.

The second field must contain values that indicate parent nodes for the current node. Here is a sample image illustrating the required structure.





The example's main report has the 'Level' parameter to store the quantity of levels of hierarchical data. A value of this parameter is used to generate the initial data table. 
When the data table has been generated, it is converted to a hierarchical list of custom objects that is used as a report data source. 
The main report contains an XRSubreport instance that refers to the detail report. The detail report in its turn contains an XRSubreport instance that recursively refers to itself.
Viewing all 7205 articles
Browse latest View live


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