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

How to preserve the XtraGrid view state in multi level master/detail

$
0
0

This example is an extension of example How to preserve the XtraGrid View state for a grid in master-detail mode. It stores view states of all existing nested grid views.

Question Comments

Added By: Glenn Holden at: 6/19/2014 12:13:58 PM    

This class is significantly different than the example which it is based on.  Could you provide a Form class to demonstrate how this RefreshHelperClass is implemented?

Added By: Nikita (DevExpress Support) at: 6/19/2014 11:47:34 PM    

Hello,
I have modified the sample so that the form's code is visible on the Web. You can also load the full project by clicking the Example link on the right side of this page (I have attached a screenshot that shown this link). 
I hope this helps.

Added By: Javier Müller at: 5/31/2015 5:13:01 AM    

If I'm rigth, this example is prepared to deal with views whose key is composed only by 1 column (keyFieldName in ViewDescriptor structure is declared as String).  In that case, how would you change it to allow views with multiple columns keys?


How to bind a dashboard to a List object

$
0
0

The following example demonstrates how to bind a dashboard to a List object.


In this example, information about the sold units quantity is provided at runtime. The dashboard data source is added to the Dashboard.DataSources collection on the first load.

To update the displayed data, the DashboardViewer.ReloadData method is called. This raises the DashboardViewer.DataLoading event and allows supplying the dashboard with updated data.

Question Comments

Added By: GUILHERME ROCHA at: 5/2/2014 2:50:26 PM    

would be possible to load the dashboard of a list of objects in a web project?
In web project there is no "dashboardViewer1.Dashboard = dashboard" property. I tried to replace "ASPxDashboardViewer1.DashboardSource = dashboard" not working. How could I do in this case?

I need use this exemple in web project.. help me!

Added By: John (DevExpress Support) at: 5/5/2014 4:52:57 AM    To achieve this goal in Web application it is necessary to create a dashboard via Dashboard designer in the same manner as illustrated in this example and assign this dashboard to ASPxDashboardViewer. To load list data to the viewer, handle the DataLoading event. Attached is a small sample project that illustrates this behavior.
I suggest you review the How to: Load a Dashboard at Runtime using Web Viewer help topic.

How to show a PDF file using the PdfViewer control

$
0
0

The following example illustrates how to load an existing PDF file into the PdfViewer control at runtime.
To do this, call the PdfViewer.LoadDocument  method. 

How to bind a dashboard to a DataSet populated from an XML file

$
0
0

The following example demonstrates how to bind a dashboard to a DataSet populated from an XML file.

In this example, an XML file provides data about car models and corresponding prices. The data source is created for the 'Cars' data table and added to the Dashboard.DataSources collection on the first load.

To update the displayed data, the DashboardViewer.ReloadData method is called. This raises the DashboardViewer.DataLoading event and allows supplying the dashboard with updated data.

OBSOLETE - How to implement check boxes with SelectRows and SelectAllRowsOnPage features in a grid's template

$
0
0

UPDATED:

Starting with version v2014 vol 1 (v14.1), this functionality is available out of the box:
S173621: ASPxGridView - Add the built-in SelectAll CheckBox for Command Column

Simply set the GridViewCommandColumn.SelectAllCheckboxMode property to GridViewSelectAllCheckBoxMode.AllPages to activate it. Please refer to the ASP.NET: GridView Select All Rows Updated blog post and the Select All Rows demo for more information.

If you have version v14.1+ available, consider using the built-in functionality instead of the approach detailed below.
If you need further clarification, create a new ticket in our Support Center.

This example not only illustrates the ASPxClientGridView.SelectRows and ASPxClientGridView.SelectAllRowsOnPage, but also shows a way in which to implement these features with check boxes within a grid's templates.

Question Comments

Added By: Bradmartin41 at: 7/19/2013 1:41:22 PM    

This works wonderfully, except I have one issue. When first selecting the 'cbAll' checkbox in the header, all rows are selected, but the header checkbox deselects itself. Then I have to select all again, then deselect. Odd behavior.

Any ideas?

Added By: Gerardo Reyes 1 at: 8/14/2014 10:17:20 AM    

This example doesnt work properly when there are two grids in the same page and try to have the same functionality with checkboxes columns

Added By: Larry (DevExpress Support) at: 8/14/2014 10:40:58 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T140431: How to implement check boxes with SelectRows and SelectAllRowsOnPage features in a grid's template when using two or more grid's. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Gherda Corrao at: 6/1/2015 3:57:34 AM    

Hi,
I need to manage a custom checkbox to perform the "SelectAll" function and I'm trying to reproduce this example in MVC, but in the Init event of the checkbox, NamingContainer is always null, how do I get the grid object in MVC?

Added By: Gherda Corrao at: 6/1/2015 4:05:14 AM    

The purpose is to replicate the functionality of the example:
https://www.devexpress.com/Support/Center/Example/Details/E3996

Added By: Mike (DevExpress Support) at: 6/1/2015 5:32:39 AM    Hello Gherda,

To process your recent post more efficiently, I created a separate ticket on your behalf: T249406: GridView - How to select all rows via custom CheckBox except disabled rows on the client side. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to determine the page number of a clicked PDF page

How to determine the PDF content type corresponding to a specific document point

$
0
0

This example illustrates how to determine the type of the PDF content corresponding to the document area that is being clicked.

How to customize a data store schema for SQL data sources

$
0
0

This example demonstrates how to customize a data store schema for a dashboard data source that uses a connection to the Northwind database.


In this example, the IDBSchemaProvider interface is implemented by a class that defines a custom data store schema. The GetSchema method returns tables and columns (with specified aliases) which will be included to a data store schema.


To see the result, create a new data source using the existing connection ("Connection 1") or edit the existing data source.

Question Comments

Added By: Mariusz Muszalski at: 2/16/2015 3:31:54 AM    

I use ConfigureDataConnection event to provide connection details for my dashboard designer. The data source is OLAP (tabular). Can I use solution above to customize names of fields in field chooser?

Added By: Andrew Aks (DevExpress) at: 2/16/2015 5:29:48 AM    

This approach can be used only for SQL data sources. We will update the Provide a way to localize OLAP cube structure in Dashboard Designer request when a similar capability is added for OLAP data sources.


ASPxDocumentViewer - How to customize a parameter editor (Creating a multi-select parameter)

$
0
0

This example demonstrates how to use a custom editor for the report's parameter to implement a multi-select parameter. The ASPxTokenBox control is used as a multi-select parameter editor.


The main idea of this approach is to use a report's parameter to pass a string that contains CategoryIDs separated by the '|' character to the report. Then on the report's DataSourceDemanded event handler the report's DataSource is populated based on the parameter value.
The ASPxDocumentViewer.CustomizeParameterEditors event handler is used to customize the report's parameter editor: assign a required editor (ASPxEditBase class descendant) to the e.Editor property, and specify its Init event. Then use this Init event handler to initialize your custom parameter editor and bind it to the data.

See also:
MVC DocumentViewer extension - Creating a multi-select parameter

How to import data to worksheet cells from different data sources and use tables

$
0
0

This example illustrates how to use the Worksheet.Import method to import data to worksheet cells from different data sources (arrays, lists and data tables), and how to format a range of cells as a table (refer to the How to: Create a Table document to get step-by-step instructions).

Question Comments

Added By: Piotr Tworek at: 5/19/2014 1:12:57 AM    

Hi
Good solution, but you can not import an ArrayList
for example

           Dim ListDataSource As New ArrayList()
           ListDataSource.Add(New Record(1, "Jane", 19))
           ListDataSource.Add(New Record(2, "Joe", 30))
           ListDataSource.Add(New Record(3, "Bill", 15))
           ListDataSource.Add(New Record(4, "Michael", 42))
Any idea?
Regards, Piotr

Added By: Yulia (DevExpress Support) at: 5/19/2014 7:17:16 AM    Hi Piotr,
I have created a separate thread on your behalf to discuss this problem: How to import data to worksheet cells from ArrayList. Please refer to it for further correspondence.Added By: Brian (DevExpress) at: 6/2/2015 7:05:05 AM    In the v15.1 release, the Worksheet.Import method enables you to import ArrayList as suggested. Also there are new Worksheet.Import overloads, please review the Add the capability to import formulas saved in the data table ticket for details. 

How to enable the Multi Selection feature in VGridControl

$
0
0

These examples illustrate how to enable the Multi Selection feature in the VGridControl. Simply place the SelectionProvider component onto a form. Since this component implements the IExtenderProvider interface, the MultiSelect property will be shown for the VGridControl in the Visual Studio Property Grid. So, you will be able to turn this option on at design time. At runtime, use the SelectionProvider.SetMultiSelect method.


In short, selection operates in a similar manner as in the GridControl. By holding SHIFT, you can select cell ranges while by holding CTRL, you can select individual cells. In addition, category rows can be selected as well.


In the case of a MultiEditorRow, separate cells within this row can be selected by holding CTRL. If you hold SHIFT, a whole MultiEditorRow will be selected.

Question Comments

Added By: Alex B. at: 6/2/2015 10:58:48 PM    

Is it also possible to highlight the header cells, i.e. all selected cells in the left (=first) column?

How to bind a dashboard to a SQL database using DashboardSqlDataSource

$
0
0

The following example demonstrates how to bind a dashboard to a SQL database using DashboardSqlDataSource.

DashboardSqlDataSource allows you to establish a connection to a data store by providing connection parameters and selecting required data by specifying a SQL query.

Question Comments

Added By: Isaque Lima at: 3/27/2014 12:35:19 PM    

Could you send me a example using a XmlFileConnectionParameters. I tried 2 ways to create a datasource, but I had problems in both.
The first one is this:
DataSet Ds = new DataSet();
Ds.ReadXml(cubeItem);
DataSource dSource = new DataSource(name, Ds.Tables[0]);

If I do this way my datasource has all the fields, but the XML saved from the dashboard does not contains the tag <DataConnections>.

The second one is this:
XmlFileConnectionParameters xmlCon = new XmlFileConnectionParameters(cubeItem);
DataConnection dc = new DataConnection(name,xmlCon);
SqlDataProvider sql = new SqlDataProvider(dc);
DataSource ds = new DataSource(name, sql);

This way the tag <DataConnection> is OK but my datasource has no fields.

I think that I must set ds.Data = Ds.Tables[0], but I can't do that, because if I do I received the following error "Additional information: Data cannot be assigned if a data provider is used".

Could send me a example with the right way to do that? Can I instead of use a XML file use a XML stream ?

thanks,

Added By: Andrew Aks (DevExpress) at: 3/28/2014 2:45:59 AM    

Currently, the DevExpress Dashboard does not support connecting to XML data files via SqlDataProvider. It is not possible to configure a connection to an XML file using a SQL query, and if you configure the connection via code, a SQL connection is required. We will update our documentation to highlight this. In the meantime you can retrieve data from XML files in code as demonstrated in the following example.

http://www.devexpress.com/Support/Center/Example/Details/E4857
Refer to the http://www.devexpress.com/Support/Center/Question/Details/Q503888 ticket to learn about the data serialization format used in the Dashboard Suite.

Added By: Isaque Lima at: 3/28/2014 11:28:15 AM    

My first approach was very similar to E4857, in this approach every thing works fine inside de dashboad editor, but when I saved the dashboard, to use in the dashboard web viewer, the xml, that is generated by the dashboard editor ,does not contain the dataConnections tag. If I create a new XML datasource using the button "New Data Source" on the application example every thing works fine. I want to know how the XML datasource is created when I use this button, because I want to create by coding, not in the UI.

Added By: Andrew Aks (DevExpress) at: 3/30/2014 11:22:52 PM    

I have extracted our conversation into a separate thread:
http://www.devexpress.com/Support/Center/Question/Details/Q468535
Let's continue our discussion there.

ObjectDataSource - How to provide a custom parameter editor.

$
0
0

This example illustrates how to provide an End-User Report Designer with a custom editor for editing a value of a parameter passed to a member of an ObjectDataSource. To achieve this functionality, substitute the report designer's repository items provider service with a custom one.

 In this example, a custom repository items provider extends the DevExpress.DataAccess.UI.Wizard.Services.DefaultRepositoryItemsProvider class and overrides its GetRepositoryItem method to dispatch a custom editor for a parameter of a custom Person type.

 To view the result, run the application. Next, in the End-User Report Designer's Report Explorer select objectDataSource1 and click the ellipse button for its Parameters property in the Property Grid. In the invoked Configure Parameters dialog, you will see the Customer parameter of the type Person. To view the custom lookup edit control used to edit this parameter, click the parameter's Value property.

How to: Customize the GridControl's Data-Aware Export Output

$
0
0

This example demonstrates how to customize the GridControl's data-aware export output.

In this example, the grid's data is exported to XLSX format using the GridControl.ExportToXlsx method with a parameter (an XlsxExportOptionsEx object) that regulates export settings and behavior. This parameter provides events that allow you to add a header and footer to the export output, to customize cells, add rows, etc.

To add a header displaying custom information to the generated MS Excel document, the XlsxExportOptionsEx.CustomizeSheetHeader event is handled. In the event handler, the AddRow, InsertImage and MergeCells methods of the event's ExportContext parameter are used to add rows with the company name and contact information, insert the company logo and merge specific cells. Cell formatting is specified using objects of the XlFormattingObject class.

The XlsxExportOptionsEx.CustomizeCell event is used to replace values in the Discontinued column with special symbols. The ColumnName event parameter allows recognizing the desired column. The Value parameter is utilized to substitute certain cell values. The Handled parameter is set to true to apply the changes made.

The XlsxExportOptionsEx.AfterAddRow event handler merges cells in rows that correspond to the grid's group rows using the ExportContext.MergeCells method. For group rows, the DataSourceRowIndex event parameter returns negative values. The current row in the export output is specified by the DocumentRow parameter.

To add a footer to the export document, the XlsxExportOptionsEx.CustomizeSheetFooter event is handled. In this event handler, two new rows are added to the output document by calling the AddRow method, and their formatting is specified using objects of the XlFormattingObject class.

The XlsxExportOptionsEx.CustomizeSheetSettings event is handled to specify export settings. The ExportContext.SetFixedHeader event method is used to anchor the output document's header to the top, and to set the fixed header height. The ExportContext.SetFixedHeader method is called to add the AutoFilter button to the document's cells corresponding to the grid column headers.

How to apply format conditions to pivot grid data cells

$
0
0
This example shows how to add format conditions to WPF Pivot Grid Control.
The top bottom rule conditional formatting is applied to the 'Quantity' measure and intersection of the 'Sales Person' and 'Quarter' fields. This condition formats data cells whose values are above average with green text and light green fill.
The icon set conditional formatting is applied to the 'Quantity' measure and intersection of the 'Sales Person' and 'Year' fields. This condition displays a specific icon in a cell according to the range to which this cell value belongs.
The data bar conditional formatting is applied to the 'Price' measure and intersection of the 'Sales Person' and 'Quarter' fields. This condition formats data cells with a predefined orange gradient data bar.

MVVM Best Practices

$
0
0

This example contains the complete MVVM Best Practices demo available from the DevExpress WinForms Demo Center. The solution is divided into separate sections; each section contains several simple examples, which cover a certain topic. Each example has a detailed description in MVVM help articles. Refer to these topics if you have any difficulties.

How to invoke the Chart Designer at runtime

$
0
0
This example demonstrates how to invoke the Chart Designer at runtime.

How to use the Workflow Module with the Entity Framework data model

$
0
0

This example uses the EF-based version of the XPO-based Workflow Demo application that is shipped with XAF. It demonstrates how to use the Workflow Module  in XAF applications where Microsoft ADO.NET Entity Framework is used for data access. The Workflow Module integrates Windows Workflow Foundation(WF) 4.0/4.5 support into XAF. WF is a workflow management framework designed to assist you in creating more manageable, workflow-enabled applications. Leveraging the WF functionality, the Workflow module is designed specifically for applications that need to handle automatic long-running business processes with intermediate steps, for example, hours, days or weeks apart, allowing users to modify automated business processes without writing any code and visualizing complex business processes. 

Important: You need to run Visual Studio as an administrator to try this example. Otherwise, the "This task requires the application to have elevated permissions" error will occur. The reason is that this example starts the service that listens to the 46232 port.

How to add the Client Chart Designer to an application

$
0
0
This example demonstrates how to add the Client Chart Designer to an application.

How to bind a dashboard to an OLAP cube using DashboardOlapDataSource

$
0
0

The following example demonstrates how to bind a dashboard to an OLAP cube using DashboardOlapDataSource.

The DashboardOlapDataSource allows you to establish a connection to the OLAP cube by specifying a connection string.

Viewing all 7205 articles
Browse latest View live


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