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

GridView - How to update total summaries on the client side in Batch Edit mode

$
0
0
This example demonstrates how to update total summaries on the client side when GridView is in Batch Edit mode. 

You can find detailed steps by clicking below the "Show Implementation Details" link .

See Also:
GridView - Batch Edit - How to calculate values on the fly 
GridView - Batch Edit - How to calculate unbound column and total summary values on the fly

ASP.NET Web Forms Example:
ASPxGridView - How to update total summaries on the client side in Batch Edit mode 

Question Comments

Added By: Rabab Siblini at: 12/20/2015 10:45:32 PM    

Perfect

Added By: Nate Huddleson at: 3/23/2016 3:01:55 PM    Is there any way to get this to work when deleting a record in batch edit mode? Or, in simpler terms, is there any way to react, on the client-side, to a batch edit mode deletion?

I've used a similar approach to this to enable and disable my own custom Save and Cancel buttons, but it doesn't work for Delete changes because those don't trigger the BetchEditStartEditing or BatchEditEndEditing client side events.Added By: Lanette (DevExpress Support) at: 3/23/2016 11:52:12 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T360009: GridView - How to update summaries when deleting a row in the batch edit mode. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.


How to: use NotificationService

$
0
0
This example demonstrates how to use NotificationService to show notifications. NotificationService is used in the same manner as other services. When the UseWin8NotificationsIfAvailable option is enabled, it's necessary to use an appropriate ApplicationId. 
This id should be specified in the application shortcut located in the "%APPDATA%\Microsoft\Windows\Start Menu\Programs" directory. This is a requirement of the technology. To create a shortcut with the required application id, you can use our DevExpress.Data.ShellHelper class as shown below:
[C#]
DevExpress.Data.ShellHelper.TryCreateShortcut("sample_notification_app","DXSampleNotificationSevice");

Then, assign sample_notification_app to the NotificationService.ApplicationId property:

[XAML]
<dxmvvm:Interaction.Behaviors>     <dxmvvm:NotificationServicex:Name="ServiceWithDefaultNotifications"ApplicationId="sample_notification_app".../></dxmvvm:Interaction.Behaviors>

An advantage of native Windows 8 notifications is that thy can be shown over WinRT applications



Question Comments

Added By: jun yang 5 at: 2/24/2015 10:53:05 AM    

Hi,
Will it work on Windows 7 with .NET 4.5.1 installed?

Jun

Added By: Ivan (DevExpress Support) at: 2/24/2015 11:41:52 AM    

Yes, it should work there. Moreover, I tested the NotificationService on Windows XP in the past, and it also worked properly.

How to use HTML5 Document Viewer within a DevExtreme application

$
0
0

This example illustrates a DevExtreme-based client application that uses the Web Document Viewer control.

The example includes the following two applications.

- Frontend that is a pure HTML5 client, to which appropriate scripts and styles are assigned (along with HTML templates required by the Document Viewer).

- Backend that is an MVC 4 application in two implementations: with the Web API Controller and MVC Controller. At the backend, cross-domain requests are enabled (Access-Control-Allow-Origin) and a custom report resolver is implemented (CustomReportResolver). 

dxDataGrid - How to implement a custom store with CRUD operations

$
0
0

The dxDataGrid binding using a CustomStore help topic and the A custom data source does not apply paging, filtering, sorting and grouping article describe how to implement a custom data source that loads data for a dxDataGrid. This example demonstrates how to make a custom store for the dxDataGrid widget manipulate data. For this purpose, we need to implement the insertupdate and remove methods in our custom store. Each of these methods will be called automatically by the widget. 

The insert method accepts a parameter that contains values for a new item. The update method accepts two parameters: the first one is a key value of the editing row, and the second one contains values of modified data fields. The remove method accepts a parameter that contains a key value of the deleted row. When a method is called, we need to send a corresponding request to our data service and pass the required parameters. We use jQuery.ajax for sending requests to our data service.

Starting with 15.2, dxDataGrid supports the sorting, filtering, grouping, paging and summary operations on the server side. See Use CustomStore - Remote Operations to learn more. It is not necessary to implement a custom store manually. It is sufficient to create it using the DevExpress.data.AspNet.createStore method implemented in the dx.aspnet.data.js library. This library is a part of the DevExtreme.AspNet.Data data layer extension for ASP.NET MVC. Please take a look at the db.js file to see how to create a custom data store using the DevExpress.data.AspNet.createStore method. You can test this solution with the data service implemented in the How to implement a data service that supports remote operations for dxDataGrid example. 


For versions prior to 15.2: 
This example can be tested with a data service from How to implement the Rest service based on an ASP.NET WebAPI application.


See also:
Use CustomStore - Remote Operations
Deferred Object
jQuery.extend
How to implement CRUD operations with a DataSource
dxDataGrid - How to implement a custom store with CRUD operations (SQLite)
Question Comments

Added By: Matthias Klein at: 10/6/2015 11:05:23 AM    

Is this a typo in line 20? ("lebgth")

Added By: Matthias Klein at: 10/6/2015 12:05:10 PM    

I have a date field in my dxDataGrid. When I update or insert a row the date is in the Format: "Thu Oct 08 2015 20:55:06 GMT +0200)". How can I change the format in which the date fields will be transfered as data?

Added By: Nikolai (DevExpress Support) at: 10/7/2015 2:23:35 AM    Hi Matthias,

Thank you for bringing this to our attention. I've updated our code.

As for "date field in my dxDataGrid", I've created a new ticket regarding this issue. Please post your comments in the T297669: dxDataGrid passes the string interpretation of a Date value to insert/update methods of CustomStore ticket.

 

Added By: David Karasek 2 at: 5/2/2016 11:08:20 AM    
Where is the code/JSON resource file for this service?    

url: 'http://localhost:59611/Categories',
Added By: Nikolai (DevExpress Support) at: 5/3/2016 2:07:34 AM    Hi David,

If you take a closer look at the decription of this example, you will see the following:

"Starting with 15.2, dxDataGrid supports sorting, filtering, grouping, paging and summary operations on the server side. See Use CustomStore - Remote Operations to learn more. The How to implement a data service that supports remote operations for dxDataGrid example demonstrates how to do this. You can use this example as a data service."

Use the How to implement a data service that supports remote operations for dxDataGrid example as the required data service.

How to implement a data service that supports remote operations for dxDataGrid

$
0
0

This example demonstrates how to implement a data service based on ASP.NET WebAPI that supports remote operations for the dxDataGrid widget. The main idea is to get all parameters passed from the client side and use them when loading data from a data base to prepare data in the required manner. We performed the following steps to implement data loading:

1. Include the DevExtreme.AspNet.Data library into our project. You can do this using the NuGet package manager.
2. Get parameters from the GET request using a custom binder - see the WebApiDataSourceLoadOptionsBinder class.
3. Pass these parameters with the required DbContext to the DataSourceLoader.Load method.

In addition, please refer to the Use Custom Store - Remote Operations help topic to learn more about all supported remote operations of dxDataGrid. You can see an implementation of a custom store for dxDataGrid in the dxDataGrid - How to implement a custom store with CRUD operations example.


See also:
How to implement the Rest service based on an ASP.NET WebAPI application

GridView - How to show LoadingPanel during export

$
0
0

When you export a grid with a large amount of data, you might want to show the LoadingPanel during exporting. To do so, handle the button's client-side Click event to:
1) Show the loading panel;
2) Perform an ajax request to the server to export the grid;
3) Hide the loading panel on success and submit the form to attach the exported document to the response;
4) Starting with version 15.1, it is necessary to call a special internal OnPost method in order to synchronize the internal grid's state to make it possible to collect and send it as custom request data (i.e., the callback state that stores end-user modifications such as sorting, grouping, filtering, selection, etc.). TODO: Use Ajax.BeginForm instead of jQuery.ajax

 

[JScript]
function OnClick(s, e){ gridView.OnPost(); $.ajax({ url: '@Url.Action("CallbackExport", "Home")', type: "POST", data: $("#form").serialize(), beforeSend: (function(data){ LoadingPanel.Show();})}).done(function(data){ LoadingPanel.Hide(); $("#form").submit();});}

 

See Also:
How to show ASPxLoadingPanel during export

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 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. For thisuse the ClearColumnFilter method.
2. Filter items with the resulting filter criteria using our internal ExpressionEvaluator class.

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

3. From the e.ComboBoxEdit.ItemsSource collection, remove all items except special items and add items that meet the filter condition.

ASPxGridView - How to implement the Select All feature for GridViewDataCheckBoxColumn when the Batch Edit mode is used


MVCxDashboardDesigner - How to save dashboards to a data base

$
0
0
This example shows how to create a custom dashboard storage that allows storing dashboards in a data base. It uses the System.Data.SqlClient members to connect and operate an MS SQL server data base. 

A custom dashboard storage should implement one of the following interfaces: IDashboardStorage or IEditableDashboardStorage.

IDashboardStorage provides functionality to open and edit dashboards available in the storage. 
XDocument LoadDashboard(string dashboardID) - returns a dashboard by its ID in the XDocument format, which describes an object model of the dashboard.
IEnumerable<DashboardInfo> GetAvailableDashboardsInfo() - returns a list of IDs and Captions of dashboards available in the data storage.
void SaveDashboard(string dashboardID, XDocument dashboard) - updates the dashboard with new settings by its id.

IEditableDashboardStorage inherits the IDashboardStorage interface and contains one additional method that allows adding new dashboards to the storage.
string AddDashboard(XDocument dashboard, string dashboardName) - takes a dashboard definition with its caption, saves it to the data storage, and returns the ID of a new saved dashboard.

Additionally, this example contains an SQL query and data base backup file,  which can be used to recreate a data base used in this example on your side.

See also:  ASPxDashboardDesigner - How to save dashboards to a data base

GridView - How to implement the Select All feature for a CheckBox column in Batch Edit mode

Spreadsheet - How to save and load documents from a database

$
0
0
UPDATED:

Starting with v16.1, Spreadsheet provides the capability to handle certain actions in the Controller. So, it is possible to save a document to a database using the Spreadsheet ribbon's 'Save' button.

UPDATED:

This code example demonstrates how to save and restore Spreadsheet documents from a database using a Binary column.
Starting with version 15.1, it is possible to use the SpreadsheetExtension.Open method to load a document and call the SpreadsheetExtension.SaveCopy method to save changes.

For Older Versions:
Use ISpreadsheetComponent.LoadDocument to load a document and ISpreadsheetComponent.SaveDocument - to save it.

See also:
T190812: ASPxSpreadsheet - How to save and load documents from a database

How to pre-filter XpoDataSource assigned to ASPxGridView

$
0
0

This example uses a combo box to filter the grid's data source. The grid works in Server mode provided by eXpress Persistent Objects. XpoDataSource has a filtering parameter, which is set within the grid's BeforePerformDataSelect event handler. The sample loads data from the AdventureWorks demo database on a local SQL Server.

See Also:
How to use XPO in an ASP.NET (Web) application
How to display and edit XPO in the ASPxGridView

Question Comments

Added By: Gabriel Joly at: 7/14/2016 7:54:54 AM    Very usefull, thank you.

ASPxGridView - How to implement cascading comboboxes in Batch Edit mode

$
0
0

In this example, the combo box in the City column (the City combo box) is populated dynamically with city names via callbacks, based on the value selected in the combo box in the Country column (the Country combo box).  
You can find detailed steps by clicking below the "Show Implementation Details" link .

See also: 
ASPxGridView - How to implement cascading combo boxes in Batch Edit mode by using WebMethods

Question Comments

Added By: umesh patel 1 at: 8/19/2014 11:34:15 PM    

Dear sir
Binding City Editor , if i have more then 400,000 cities need to be bind, Shall i used same binding concept of i used linqservermodedatasource for the binding to increase performance. Can you please send me sample project how can i use linqservermodedatasouce.  
Thanks for your time

Added By: Artem (DevExpress Support) at: 8/20/2014 6:41:34 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T142172: ASPxGridView - How to implement cascading comboboxes bound to a large data in Batch Edit mode . This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: umesh patel 1 at: 8/20/2014 11:01:37 PM    

in CITY edittor inside GridViewDataComboBoxColumn , EditItemTemplate instead of ASPxComboBox i can use aspxlookup becuase i want to provide user to search item based on incremental search

Umesh

Added By: Artem (DevExpress Support) at: 8/20/2014 11:57:38 PM    

Hello,

To avoid discussing multiple topics in this thread, I created a separate ticket on your behalf: T142423: ASPxGridView - Batch Edit - How to use ASPxGridLookup bound to a large database with incremental filtering in EditItemTemplate. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Zoltán Gelencsér at: 6/23/2015 5:23:30 AM    

Dear Support Team,

I've integrated this solution into my project.
It is working well but I have little (huge) problem with it.
If I use Enter key to move cursor from the column to the next column, which is a cascased combobox, and I'm fast and I use 2 times Enter key the combobox value is shown and cleared and the focused column is the next column after combobox.

I've analyzed the code.
The OnBatchEditStartEditing set value of Combobox but the PerformCallback of combobox clears it.
In client side event endcallback I reset it back to the original value. It is working well if I do not leave the combobox column fast.

I hope you have solution for this problem.

Best Regards,

Zoltán

Added By: Artem (DevExpress Support) at: 6/24/2015 1:30:14 AM    

Hello Zoltán,

To process your recent post more efficiently, I created a separate ticket on your behalf: T259299: ASPxGridView - Batch Edit - Issue with cascading comboboxes. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to: Adjust the size of pop up dialogs

$
0
0

ASP.NET
A complete description for the  ASP.NET version is available in the How to: Adjust the Size of Pop up Dialogs displayed in ASP.NET Applications topic.


WinForms
Check out the PopupSizeExample.Module.Win\Controllers\CustomizeFormSizeController.xx file and code comments in it. See also the following product documentation:
Concepts> Extend Functionality> Controllers
DevExpress.ExpressApp> Frame> TemplateChanged
DevExpress.ExpressApp> XafApplication> CustomizeTemplate
DevExpress.ExpressApp.Templates> ISupportStoreSettings> SettingsReloaded

How to use the DXSerializer.LayoutUpgrade event to upgrade a layout from one version to another

$
0
0

Sometimes it may be necessary to change the layout in your application (e.g., add a panel into the DockLayoutManager, rearrange groups, or add columns into the GridControl). In this case, a previously saved layout may require manual patching during the layout restoration. For this purpose, you can use the DXSerializer.LayoutUpgrade event. This event is raised if a restored layout version is lower than the current one. To set a layout version, use the DXSerializer.LayoutVersion attached property. 

Question Comments

Added By: Anand Jayaprakash at: 7/15/2016 1:10:51 PM    Hi,

Thank you for the response. Is there a way to figure out the list of incompatibilities?


Regards,
AnandJ Added By: Alexander Ch (DevExpress Support) at: 7/15/2016 2:03:24 PM    

Anand,

I've posted your commend in the T403971 - DXGrid column chooser - columns are showing up as blank - after column rename thread. Let's continue our discussion there.

Thanks,

Alex


How to bind a Snap document to multiple data sources in code

$
0
0

This example illustrates how you can bind a Snap document to multiple data sources:
- XPCollections with one-to-many relationship
- a data table contained in the System.Data.DataSet object,
- Excel data source,
and set one of the available data sources as the mail merge source ("Use for Mail Merge" option) using the SnapControl.Options.SnapMailMergeVisualOptions.DataSourceName property.

Question Comments

Added By: Valentin Badea at: 7/15/2016 11:26:06 PM    VB version ?

How to use custom graph layout algorithms to arrange shapes in DiagramControl

$
0
0
DiagramControl provides two methods that make it easier to use external graph layout algorithms to arrange diagram shapes. The GraphOperations.GetDiagramGraph method reads the diagram currently loaded into DiagramControl and returns the Graph object that contains collections of edges and nodes represented by diagram items. You can use this information to calculate positions for diagram shapes. Then, for every shape, create the PositionInfoobject containing the shape reference and its position. To apply the layout to the loaded diagram, call the DiagramControl.RelayoutDiagramItems method that accepts the collection of PositionInfo objects.

This example demonstrates how the GetDiagramGraph and RelayoutDiagramItems methods can be used to connect the Microsoft Automatic Graph Layout library to DiagramControl.
Question Comments

Added By: Valentin Badea at: 7/15/2016 11:35:17 PM    VB version ??

How to calculate a route between two addresses

$
0
0
This example demonstrates how to calculate a route between two addresses.
Question Comments

Added By: Valentin Badea at: 7/17/2016 3:24:09 PM    VB.NET ?Added By: John (DevExpress Support) at: 7/17/2016 11:55:07 PM    Hello Valentin,
We have added the VB solution to this example.

LookupEdit - Standard Binding (to Simple Data Types)

$
0
0
This example shows how to use an in-place LookUpEdit control (RepositoryItemLookUpEdit) for editing cells in a grid column.

The lookup editor in the example is used to edit the CategoryID field values from the Products list. However, instead of displaying category IDs, the editor will display corresponding category names in the edit box.

The main properties used to set up the LookUpEdit control are:
- DataSource - Specifies the lookup data source.
- ValueMember - Specifies the field from the lookup data source whose values match the editor's edit value.
- DisplayMember - Identifies the field from the lookup data source whose values match the editor's display text.
Question Comments

Added By: Valentin Badea at: 7/17/2016 3:38:51 PM    VB ?Added By: Stas (DevExpress Support) at: 7/18/2016 12:27:39 AM    

Hello Valentin,
I've added the VB solution to this example.

P.S.
To be able to convert any C# project to VB, you can use a free Instant VB tool.

GridView - How to implement row copy / clone functionality

$
0
0

This example is based on the E3983: GridView - How to edit in memory data source example.
It illustrates how to implement row copy / clone functionality similar to the ASP.NET WebForms solution illustrated in the online Grid Columns - Custom Buttons demo.

Here are the main implementation details:
- Specify the GridViewSettings.CustomActionRouteValues.Action property - a method for custom callbacks routine;
- Add a new Custom Button;
- Handle the client-side ASPxClientGridView.CustomButtonClick event;
- Get the clicked row's keyValue via the client-side ASPxClientGridView.GetRowKey method. Pass the e.visibleIndex property as a parameter;
- Store the retrieved row's keyValue;
- Perform a custom grid callback via the client-side ASPxClientGridView.PerformCallback method;
- Handle the client-side ASPxClientGridView.BeginCallback event. If the custom callback is currently processing (e.command equals "CUSTOMCALLBACK"), populate the e.customArgs item with the stored keyValue. See the Passing Values to Controller Action Through Callbacks help article to learn more on how to deal with this option;
- Handle GridViewSettings.CustomActionRouteValues.Action. Pass the stored keyValue to the PartialView via the ViewData;

In the PartialView:
- Handle the GridViewSettings.BeforeGetCallbackResult event. If there is an item in the ViewData, start editing a new row via the MVCxGridView.AddNewRow method;
- Handle the GridViewSettings.InitNewRow event. If there is an item in the ViewData, copy row values from the original row to the new one.

Question Comments

Added By: Satendra Jindal at: 7/17/2016 11:50:34 PM    At least you should have given demo. Added By: Mike (DevExpress Support) at: 7/18/2016 1:00:59 AM    

Hello,

I've created a separate ticket on your behalf (T404305: How to download and play E4643 example). It has been placed in our processing queue and will be answered shortly.

Viewing all 7205 articles
Browse latest View live


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