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

Obsolete: How to use different DataFieldUnboundExpressionMode for different fields in the same PivotGridControl

$
0
0

Update: Starting with version 15.1, it is possible to define the expression calculation mode for individual fields using the PivotGridField.UnboundExpressionMode property. Refer to the S135276: Provide the capability to define DataFieldUnboundExpressionMode at the Data Field level thread for additional information. 

In this example, the DataFieldUnboundExpressionMode property is set to UseSummaryValues. For fields where it is required to calculate unbound values using the standard behavior the CustomUnboundFieldData event is handled. The ExpressionEvaluator.Evaluate method is used to calculate a summary value based on an unbound expression that has been passed.
Since the CustomUnboundFieldData event is not raised for fields with a predefined UnboundExpression Property, unbound expressions for these fields are stored in separate dictionaries, and their UnboundExpression Property is cleared.


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

Worksheet extensions are defined by the WorksheetExtensions class. To enable them, add a reference to the DevExpress.Docs.vX.Y.dll library. Note that distribution of this assembly requires a license to the DevExpress Document Server or the DevExpress Universal Subscription.

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 filter pivot grif to show Top Values calculated by a certain measure using the popup menu

Multiple selection using checkbox (web style)

$
0
0

From version 13.2, the GridView in the XtraGrid control provides a built-in checkbox column for multiple row selection.

This feature is demonstrated in the following example: How to use an unbound check box column to select grid rows. Additional information can be found in the following topic: Multiple Row Selection via Built-In Check Column


Projects attached to the current article target earlier versions of DevExpress controls, which did not provide the built-in checkbox column for multiple row selection.
These examples show how to manually add a check column to allow web-style multiple row selection. End-users can select/deselect rows, group rows or select/deselect all rows by clicking the column header. Changing a check box value does not initiate row editing. These examples are based on the A371 article.

Question Comments

Added By: Marc Roussel at: 10/11/2012 5:59:00 AM    

Hmmm how do I use this class ?

Added By: You Logic at: 10/16/2012 4:16:54 AM    

When I select a row via code, the check box is not checked. How can I do this!?

Added By: Piotr Christ at: 2/8/2013 4:13:11 AM    

I had the same problem as You Logic ! How select row (with checkbox) from code ?

Added By: (no info) at: 11/25/2013 2:23:24 PM    

While this is a very nice implementation there is a problem with the code. Because you have defined selection *in the CheckMarkSelection.cs" as an ArrayList it is next to impossible to get at any values contained within each of the actual selected rows from the grid. Let's say one needs to obtain two of the values within the row...one is a string and one is an integer...how do you get the values out? There are no extension methods associated with "selection" that would allow you to enumerate the data lets say using linq or even simply doing somethin like: DataRowView theRow = (DataRowView)this.selection.GetSelectedRow(i); What happens is there is a cast error that occurs due to the generic types within the ArrayList. Granted this is necessary as we have an unknown group of column objects and values. There needs to be a built in method to access the individual values in the selected rows from "selection". I have tried 12 different methods to extract them and still a Cast error occurs.

Added By: Dave Smith 6 at: 3/4/2016 2:15:24 AM    After implementing this class the column does not show, not sure what I'm doing wrong.

In the constructor of my form  I call  new GridCheckMarksSelection(gridViewSearchInventory);

and then in the form load i bind to my grid Added By: Sasha (DevExpress Support) at: 3/4/2016 6:20:43 AM    

Hello Dave,
I've created a separate ticket on your behalf: GridControl - The check box column is not shown when using a class from the E1271: Multiple selection using checkbox (web style) example .
We will update it shortly.

How to print a report

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

$
0
0

This example demonstrates how to implement the Rest service based on an ASP.NET WebAPI application.

See also:
How to configure ODataService for a DevExtreme HTML5/JS application
Creating a REST service using ASP.NET Web API
An Introduction To RESTful Services With WCF
How to implement CRUD operations with a DataSource

Question Comments

Added By: Nikolai (DevExpress Support) at: 10/6/2015 12:35:29 AM    Hi Matthias,

Please post your comments regarding this issue in the Accessing data source in dxDataGrid for updating Id from ControllerAction ticket.

ASPxGridView - How to turn off automatic auto filter row processing

$
0
0

This example demonstrates how to turn off the automatic auto filter row processing and perform the filtering of all rows simultaneously by a button click. Perform the following steps to implement this scenario:


1) Remove the standard client-side ValueChanged and KeyDown event handlers for the filter row editors and create the custom handler. Use the ASPxClientEvent.ClearHandlers and ASPxClientEvent.AddHandler methods for this purpose:


[C#]
protectedvoidgv_AutoFilterCellEditorInitialize(objectsender,DevExpress.Web.ASPxGridView.ASPxGridViewEditorEventArgse){ASPxTextBoxeditor=e.EditorasASPxTextBox;if(editor!=null){editor.ClientSideEvents.Init="function(s, e) { s.ValueChanged.ClearHandlers(); s.KeyDown.ClearHandlers(); s.KeyDown.AddHandler( function(s, e) { if(e.htmlEvent.keyCode ==13) ASPxClientUtils.PreventEventAndBubble(e.htmlEvent);} ); }";editor.ClientInstanceName="filterRow_"+e.Column.FieldName;}}

 

[VB.NET]
ProtectedSub gv_AutoFilterCellEditorInitialize(ByVal sender AsObject, ByVal e As DevExpress.Web.ASPxGridView.ASPxGridViewEditorEventArgs)Dim editor As ASPxTextBox = TryCast(e.Editor, ASPxTextBox)If editor IsNot NothingThen editor.ClientSideEvents.Init = "function(s, e) { s.ValueChanged.ClearHandlers(); s.KeyDown.ClearHandlers(); s.KeyDown.AddHandler( function(s, e) { if(e.htmlEvent.keyCode ==13) ASPxClientUtils.PreventEventAndBubble(e.htmlEvent); } ) ; } " editor.ClientInstanceName = "filterRow_"& e.Column.FieldNameEndIfEndSub

 

2) Now, when automatic filter is processing is turned off, it is necessary to perform filtering manually via the ASPxClientGridView.ApplyFilter method:

[JScript]
function ApplyFilter(){var filterCondition = "";var andOperator = "";for(var i = 0; i < gridViewR.GetColumnsCount(); i++)if(gridViewR.GetAutoFilterEditor(i) != null){if(filterCondition != "") andOperator = "And "var editor = eval("filterRow_" + gridViewR.GetColumn(i).fieldName);if(editor)if(editor.GetText() != "") filterCondition = filterCondition + andOperator + "Contains( [" + gridViewR.GetColumn(i).fieldName + "]," + "'" + editor.GetText() + "')";} gridViewR.ApplyFilter(filterCondition);}

Update:
Starting with version v2013 vol 2.5, we have implemented the new 'on click' filter mode. In this mode, a filter is applied to the grid by clicking the Apply button, which is displayed in a command column. 

To provide your application with this functionality, display the filter row in the grid by setting the ShowFilterRow property to true and set the FilterRowMode property to OnClick.

Question Comments

Added By: Shelby Holden at: 3/7/2016 11:43:29 AM    In your example, you manually set the filter menu type to "Contains". What are the key words for the other types of filtering? (Begins with, Ends with, etc.)? 

How to: Use EventToCommand

$
0
0
This example demonstrates how to use the EventToCommand.
Review this documentation topic to learn more.
Question Comments

Added By: pablo Aguilar-Lliguin at: 3/7/2016 1:40:34 PM    I feel the viewModel is incomplete.

MainView call:

Command="{Binding EditCommand}"

but that not appears in the ViewModel and I don't view where is the value of converter

How to use the ASPxGridView control (with the enabled vertical scrollbar) in a Full Screen mode (100% browser Width and Height)

$
0
0

This example demonstrates how to resize the ASPxGridView control based on the browser window size.

See Also:
How to use the ASPxPageControl control in a Full Screen mode (100% browser Width and Height)

Question Comments

Added By: neuDev33 at: 5/16/2012 11:48:45 AM    

I'm copy + pasting this code, but the height does not increase to cover the parent control

Added By: just wqq at: 9/18/2012 7:45:13 PM    

DevExpress.Web.ASPxGridView.v8.3 can do this

Added By: Michelle Young at: 7/31/2013 7:46:42 AM    

Visual studio says the code behind method is obsolete and you should now use RegisterBaseScript instead.

Added By: Yevgeniy Reznik at: 7/31/2013 8:45:41 PM    

Can you please update to the latest version of DevExpress?

Added By: Honesto Manlig at: 5/28/2014 9:03:24 PM    

How can I have the columns to be of width they need to be. Except for the last column to be the only one that grows to fill the rest of the gridview. For example, if there's three columns, if first column contains  text, it'll get as wide as it needs to so it does not wrap the text, then second column is a checkbox, so can always be same width, then the last column must get wide enough so that it fills the rest of the grid's width.

Added By: Artem (DevExpress Support) at: 5/29/2014 12:01:42 AM    Hello,

I've moved your question to a separate thread created on your behalf:
How to use the ASPxGridView control (with the enabled vertical scrollbar) in a Full Screen mode (100% browser Width and Height)
Please refer to it for further correspondence.Added By: Robert Schoen at: 3/8/2016 10:37:29 AM    It is important to note that the ClientInstanceName needs to be set so that the java script can find the control that needs to be resized.   I struggled with this for several hours before I found the key.

How to pass a multi-value parameter to a query

$
0
0
This example illustrates a workaround to use multi-value parameters in a query string.

At present, query parameters cannot be directly mapped to multi-value report parameters, and this task is solved by adding a WHERE clause to the SQL string in the following way.

[SQL]
SELECT [Categories].[CategoryID], [Categories].[CategoryName] FROM [Categories] [Categories] WHERE [Categories].[CategoryID] IN (1,2,3)

This example illustrates how to dynamically update the query string using values assigned to a report parameter.

How to use GridLookup in Custom Data Binding mode

ASPxDataView - How to assign the ItemTemplate property at runtime

$
0
0

This example demonstrates how the ASPxDataView's template of the ItemTemplate type can be created dynamically. The template is represented by a UserControl that contains a panel with several controls.
To assign the ASPxDataView's ItemTemplate property via code, a specific class (MyItemTemplate) that realizes the ITemplate interface is implemented. Within the InstantiateIn method of this class, the UserControl's content is loaded into the template container by using the LoadControl method.

How to assign multiple values to a report parameter from a connected data source

$
0
0

This example demonstrates how to create a multi-value parameter and pass it to a report at runtime. 

To do this, create an instance of the Parameter class and provide it with a set of lookup values. In this example, the parameter values are obtained from a data source. To learn how to assign these values in code, see How to assign multiple values to a report parameter.


Set the parameter's MultiValue property to true, which allows the parameter to have more than one value. After that, the parameter's values can be used in the report's FilterString

When previewing the resulting report, an end-user will be prompted to specify values for the parameter using the drop-down multi-select list.

How to assign multiple values to a report parameter

$
0
0

This example demonstrates how to enable an end-user to assign multiple values to a report parameter in a Print Preview.
To do this, create an instance of the Parameter class and provide it with a set of lookup values. In this example, the parameter values are assigned in code. To learn how to obtain these values from a data source, see How to assign multiple values to a report parameter from a connected data source.

Set the parameter's MultiValue property to true, which allows the parameter to have more than one value. After that, the parameter's values can be used in the report's FilterString
When previewing the resulting report, an end-user will be prompted to specify values for the parameter using the drop-down multi-select list.

How to show elements in ASPxFileManager in a custom order

$
0
0

This example demonstrates how to make ASPxFileManager show folders in the descending order. This behavior was implemented by using the CustomFileProvider class.


How to bind ASPXGridView to a data source with various number of data fields

$
0
0

This example shows how to use ASPxGridView with several predefined columns and automatically add the rest of them. The current implementation uses a custom ColumnUpdater class for saving and updating a column collection of the ASPxGridView. For this purpose, the grid was subscribed in the ASPxGridView.Init event with the ColumnUpdater class.
In this example, the grid is loaded in the ASPxCallbackPanel.Callback event. To show the grid, please click the button.

How to create drill-down documents with DXPrinting for WPF

$
0
0

This example demonstrates how you can provide interactivity for documents that are displayed in a Document Preview for WPF.

In particular, it shows how you can implement a drill-down document, in which detail data is hidden until a user clicks a link in the Document Preview, after which the corresponding part of data is shown in the same document.

Starting with the 15.1 version, XtraReports supports automatic drill-down, so writing any code is no longer required to accomplish this task.

Data Aware Export - How to add custom header and footer to an exported Excel document

How to preview a report in a Web application

$
0
0

This example illustrates how to publish a report on the web. In this example, the report is stored in a page session that is assigned to an ASPxDocumentViewer.

To learn how to generate the report layout in code, see How to dynamically create a report in an ASP.NET Web Forms application (with a SQL query as a data source).

Question Comments

Added By: drzej at: 12/13/2014 4:48:02 PM    

aspx is only for dx 8.3

Added By: Andrew L (DevExpress Support) at: 12/15/2014 5:13:12 AM    

Hello Andrzej,


I have updated this sample to use ASPxDocumentViewer instead of the Report Viewer. Please review the 2014.2+ related version of this sample.

Added By: Ajith Kumar Rai at: 2/19/2016 3:14:05 AM    Can you please elaborate about  this type  "DataSet1"  and  "DataSet1TableAdapters" in XtraReport1.cs file.Added By: Jannet (DevExpress Support) at: 2/19/2016 3:42:01 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T347655: Can you please elaborate about this type "DataSet1" and "DataSet1TableAdapters" in XtraReport1.cs file. This ticket is currently in our processing queue and will be addressed shortly.

How to preview a report in a WPF application

Viewing all 7205 articles
Browse latest View live


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