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

How to Filter Large List Views via the Auto Filter Row

$
0
0

This example demonstrates how to avoid the display of the entire collection of a List View with a large object count in Windows Forms applications. One of the ways to do this is to use the Auto Filter Row of the XtraGrid used in Windows Forms applications to display List Views.

See code in the AutoFilterRowController.cs (AutoFilterRowController.vb) file. For details, refer to the How to: Filter Large List Views via the Auto Filter Row topic in XAF documentation.

Question Comments

Added By: Wieland Voß at: 9/17/2014 1:38:23 AM    

Hi,

is there a way to apply this behaviour in a ASP.Net Application, as well?

Added By: Konstantin B (DevExpress) at: 9/17/2014 2:28:47 AM    Hello Wieland,

Currently, we do not have a similar example for ASP.NET. Would you please clarify why you need to apply this behavior? If you experience performance issues in your ASP.NET aplication, you can simply enable the Server Mode using the DataAccessMode property of the ListView node in the Model Editor.

The use of Automatic Filter Row without special symbols

$
0
0

When an end-user enters text into the AutoFilterRow for filtering that begins with '_' or '%', GridControl automatically replaces the AutoFilterCondition with "Contains" and uses the entered text without the first symbol as filter criteria.
To avoid this, it is necessary to create a TableView child and override the CreateAutoFilterCriteria method.

How to reorder ASPxGridView rows using buttons or drag-and-drop

$
0
0

This example demonstrates how to move ASPxGridView rows using buttons or jQuery Drag&Drop.


To keep the order of rows, it is necessary to set up an extra column to store row order indexes. Then, sort ASPxGridView by this column and deny sorting by other columns. This example stores this information in the unbound column and additionally puts a dictionary "row key = row index" to the session. We have implemented this approach only for demo purposes. You can store this information in your DataSource.

See also:
E1810: How to use jQuery to drag and drop items from one ASPxGridView to another

E3850: How to reorder ASPxTreeList sibling nodes, using buttons or drag-and-drop
E4299: How to move up or down a line a row of ASPxGridView by using external buttons

Question Comments

Added By: Hiren Joshi (Venture) at: 8/20/2013 3:03:21 PM    

Hello,

I have seen your example however I have a question from user view point. Once you start to drag a row button you don't have any way to tell which row you are dragging. So unless you remember the row to started with it will be diffcult for users to use this practically. Do you have a way to drag the entire row or have a button with some text to identify the row you are dragging? Please let me know if this is possible.

Added By: Jacob Blumberg at: 8/27/2013 4:05:00 PM    

I agree, that is what I am looking for too.

Added By: Hiren Joshi (Venture) at: 9/11/2013 10:54:22 AM    

I was able to use the link tag <a href=""><%#Eval("YourData")%></a> instead of the image; in order to over come the problem of knowing which row is being dragged. So now when I drag the row I can see the text that I am dragging.

Added By: Wouter Stichelbout at: 2/11/2014 7:54:23 AM    

I there an MVC equivalent?

Added By: Vasily (DevExpress Support) at: 2/11/2014 9:48:17 AM    

Hi Wouter,

I have extracted your question to a separate ticket created on your behalf: Q466606: GridView - How to reorder GridView rows using buttons or drag-and-drop.
Your time and cooperation are appreciated.

Added By: Walter Rijk at: 6/23/2014 1:45:25 AM    

Hello,

This approach much more resembles the way Telerik has implemented row dragging and dropping:

       function InitalizejQuery() {
           var openhand = "url(https://mail.google.com/mail/images/2/openhand.cur), move";
           var closedhand = "url(https://mail.google.com/mail/images/2/closedhand.cur), move";

           $('.dxgvDataRow, .dxgvFocusedRow').each(function () {
               $(this).css({ "cursor": openhand });
           });
           $('.dxgvDataRow, .dxgvFocusedRow').draggable({
               helper: function () {
                   var result = $("<table class='dxgvTable' cellspacing='0' cellpadding='0' style='opacity:0.7;background-color:#dddddd;'>").append($(this).clone()).append($("</table>"));
                   $("td", this).each(function (index) {
                       $("td", result).eq(index).css({ 'width': $(this).width() });
                   });
                   return result;
               },
               axis: "y",
               start: function (event, ui) {
                   $("tr", $(this).parent()).each(function (index) {
                       $(this).css({ "cursor": closedhand });
                       $(this).removeClass('dxgvFocusedRow'); // this is the same as removing the focussedrowindex
                       $(this).addClass('dxgvDataRow');
                   });
                   $(this).addClass('dxgvFocusedRow');
               },
               stop: function (event, ui) {
                   $(this).css({ "cursor": openhand });
               }
           });
           $('.dxgvDataRow, .dxgvFocusedRow').droppable({
               drop: function (event, ui) {
                   var draggingRowKey = ui.draggable.find("input[type='hidden']").val();
                   var targetRowKey = $(this).find("input[type='hidden']").val();
                   gridView.PerformCallback("DRAGROW|" + draggingRowKey + '|' + targetRowKey);
               }
               , over: function (event, ui) {
                   var targetRowKey = $(this).find("input[type='hidden']").val();
                   var rowindex = gridView.keys.indexOf(targetRowKey);
                   window.setTimeout(function () { gridView.MakeRowVisibleNew(rowindex); }, 100);
                   $(this).addClass('borderClass');
               }
               , out: function (event, ui) {
                   $(this).removeClass('borderClass');
               }
           });
       }

Best Regards,
Ernstjan Freriks

How to use sorting and filtering with a custom object

$
0
0

When a column contains custom objects as values, these custom objects cannot be compared directly. Data can be sorted and filtered by displayed text. It can be done in the following way:

1) Change the column CellTemplate property that allows an end-user to change object values (e.g., select them from the ComboBox);

2) Set EditSettings for this column and define DisplayTextConverter;

3) Set the SortMode and ColumnFilterMode properties to DisplayText, and set the AllowSorting property to true.

The end-user will always see the data set from CellTemplate, but sorting and filtering will be applied by using text converted by DisplayTextConverter.

How to implement conditional formatting for rows

$
0
0

The following sample demonstrates how to change the appearance of grid rows based on some condition. For example, in this tutorial you can see that the background color of grid rows is gradually changed based on the value in the second data column.

This is done by binding the Background property of a style, assigned to a row, to a color converter. This converter is represented by the ColorValueConverter class that implements the IValueConverter interface and returns a color according to the provided numerical value.

Updated:

In v14.1, we implemented this functionality out-of-the-box. Please refer to the Conditional Formatting help topic for details.

Question Comments

Added By: Fahad at: 7/9/2013 3:50:45 AM    

Is there an easy way to Style each cell ? Or we have to use DataTemplate ?

Added By: Mary Roy at: 6/5/2014 1:46:45 PM    

Your sample does not work

Added By: Michael Ch (DevExpress Support) at: 6/6/2014 12:42:08 AM    Hello Mary,

Thank you for your remark. I have corrected this sample. Please review it.

Thanks,
Michael

Added By: ArunKallingal at: 9/17/2014 5:47:31 AM    

Can I get an example project for this?

Added By: Ivan (DevExpress Support) at: 9/17/2014 11:07:39 AM    

Sure. Here are good instruction on how to download examples - How to download a project attached to a Knowledge Base article. Follow the instructions starting from the "Download and install the "Example runner"..." point.

How to create dxPieChart using the AngularJS approach

How to export several controls to different XLSX worksheets

$
0
0

This example illustrates how to export ASPxGridView, ASPxTreeList, and WebChartControl to different worksheets of one xlsx document

See also:
How to combine a number of ASPxGridView documents in one when exporting
How to export the ASPxGridView and WebChartControl to the same print document

Question Comments

Added By: kishore Grandhe at: 9/17/2014 10:08:33 PM    

Sorry.. I was referring to Windows forms. Can you please help how to export mltiple xtra grids into one single work sheet with a line seperator for easy readability.

Added By: Helen (DevExpress Support) at: 9/18/2014 12:01:49 AM    

Hello,

We found that you created a separate ticket dedicated to this question: T151815: Export multiple grids to Excel into 1 single sheet with a line seperator (Windows Forms). Please refer to it for further assistance. We passed it to our WinForms team and it is already in their queue.

How to: Change the application logo


How to define a report dynamically in the Web application

$
0
0

This example illustrates how to create a report dynamically in the web application

How to reorder dxDataGrid rows using drag-and-drop

$
0
0
This example demonstrates how to move dxDataGrid rows using Draggable and Droppable plug-ins. 

To accomplish this task, we need to perform the following steps:

1. Set a fake CSS class ("myRow") to a data row. This will help us find all data rows using a jQuery selector and assign Draggable and Droppable plug-ins to the rows. Assign the key value of each row to a row element. We need to use the dxDataGrid.rowPrepared callback function for this step.
2. When the drop event fires, we need to get indexes of the dropped and the target rows, recalculate indexes according our requirements and save them to a data store.
3. Reload data by calling the dxDataGrid.refresh method.

See also:
ArrayStore.load
ArrayStore.byKey
ArrayStore.update
.data()

How to show filter dialog before showing ListView

$
0
0

Scenario:

When a user executes a navigation item that displays a large ListView, the application should display a popup window that allows you to define a filter for this ListView before loading records in it. This filter dialog should remember the user's choice and provide the capability to select one of the stored filters.

Steps to implement:

1. Create a ListView model extender - IModelListViewExt - that adds the AdditionalCriteria property to the ListView model to store the filter selected by the user.

2. Implement the ViewFilterContainer class whose DetailView is used as a filter dialog.

3. Implement the ViewFilterObject class which is used to store filters.

4. Implement the ShowFilterDialogController which shows the filter dialog instead of displaying the ListView, and then shows the filtered ListView. To do this, subscribe to the ShowNavigationItemController.ShowNavigationItemAction.Execute event and replace the ListView from the e.ShowViewParameters.CreatedView property with the ViewFilterContainer DetailView. Then show the filtered ListView via the XafApplication.MainWindow.SetView method.

5. Implement the NewViewFilterObjectController which sets the ObjectType property of the ViewFilterObject object created by the ViewFilterContainer.Filter lookup's New action.

See Also:
How to: Use Criteria Property Editors
How to: Extend the Application Model and Schema
ShowNavigationItemController Class
Dialog Controller

Question Comments

Added By: Pablo Mazaeda 1 at: 11/13/2012 6:21:47 AM    

how do I do this for ASP.NET?

Added By: Mandeep Singh 10 at: 2/16/2014 6:57:38 AM    

Tried to download this Example. Returns the following error

Server Error in '/Support/Center' Application.

Added By: Anatol (DevExpress Support) at: 2/16/2014 11:49:17 PM    

This was likely a temporary issue. Please try to download the example once again.

Added By: Wieland Voß at: 3/4/2014 1:16:39 AM    

Hi Anatol,

how do we implement this solution for the asp.net environment? Simply importing DevExpress.ExpressApp.Web in ViewFilterContainerDetailViewController doesn't seem to meet our needs, since LookupPropertyEditor and LookupEdit are unknown.

Thank you
Wieland

Added By: Anatol (DevExpress Support) at: 3/4/2014 7:57:15 AM    

I have updated the example. Now its code is platform-independent and will work correctly in the ASP.NET project.

Added By: Wieland Voß at: 3/5/2014 7:32:50 AM    

Thank you for your quick answer!

The implementation works fine, but ,unfortunately, is way too slow in web-modus :(
It seems, that the generation of large lookup-lists (millions) during filter-creation takes a lot of time. Do you have any hint, how to prevent this behaviour?

Added By: Mauro Assis at: 9/18/2014 2:04:25 PM    

This is working great, but everytime I click a navigation item it creates a new "Default" filter. I'm using Web Application, would this matter?

ASPxGridView - How to implement copy / clone functionality in Batch Edit mode

GridView - How to implement copy / clone functionality in Batch Edit mode

$
0
0
This example demonstrates how to add copied values to a new row on a custom command button click using a new client-side API implemented in the following threads:
ASPxGridView - Batch Edit mode - Provide a client-side API to obtain/modify cell values without entering edit mode 
ASPxGridView - Batch Edit mode - Provide client-side events that allow responding to entering and leaving the edit mode

WebForms version:
T114985: ASPxGridView - How to implement copy functionality in Batch Edit mode
Question Comments

Added By: Mitra Ebrahimi at: 8/16/2014 9:53:06 PM    

thanks for your fast answering but my problem is totally different.
when I add these gridview which has got batch editing mode in the main pane of a splitter.
my edit or delete or new button in gridview do not work any more.

Added By: Alex Sembiring at: 8/17/2014 11:23:02 PM    

Hi,

How to change the text "Copy" to be a Copy Icon in this fuction: settings.CommandColumn.CustomButtons.Add(new GridViewCommandColumnCustomButton() { ID="CopyButton", Text="Copy" });

Thank you

Added By: Artem (DevExpress Support) at: 8/18/2014 12:52:47 AM    

Hello,

To process your requests more efficiently, I've created separate threads for them: 

1) @Mitra: GridView - Batch Edit - Grid isn't switched to edit mode inside SplitterPane 

2) @Alex: GridView - How to apply an icon to a custom command button 

Please refer to these for further correspondence. These tickets are currently in our processing queue. Our team will address them as soon as we have any updates.


Thanks.

Artem

How to bind a report to a datasource, whose data is loaded from an XML file

$
0
0

This code sample illustrates how to bind a report to XML data stored in a file (Cars.xml in this case). To accomplish this task, create a SqlDataSource. Then, create a TableQuery to access data of the required data table. To include a table in the query, use the TableQuery.AddTable  method. Next, specify columns to include in the table using the TableInfo.SelectColumns method.

How to use CellStyle in different themes

$
0
0

To implement a cell style of GridControl, it is necessary to create a new style based on the already existing cell style. When an application theme is changed, the basic cell style must be also changed. To do this, you can create behavior that will change this basic style. It is necessary to add the ThemeManager's ThemeChanged event handler to the behavior.


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

$
0
0

The FileSystemData module provides the FileSystemStoreObject and FileSystemLinkObject classes that implement the IFileData interface and enable you to store uploaded files in a file system instead of the database.
   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 it in action: http://www.screencast.com/t/Xl1GMfxw
Feel free to share your feedback on the module at http://community.devexpress.com/forums/t/71862.aspx


IMPORTANT NOTES
1.
The current version of this example does not support the middle-tier scenario. Refer to the Q476039 ticket for more details.
2. It is required to set the BaseObject.OidInitializationMode property to OidInitializationMode.AfterConstruction for the correct operation of this module.

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.

Runtime table creation best practices (iterative approach)

$
0
0

This example demonstrates the differences in runtime table creation between the newest XtraReports version and its prior versions.

Please note that it is always required to call the XRTable.BeginInit and XRTable.EndInit methods if you modify XRTable.Rows and XRTableRow.Cells collections at runtime.

As for the height of a table, explicitly specify it only if cells' content is not expected to stretch the cells (e.g. this may happen when their CanGrow property is enabled).

Question Comments

Added By: DXScorpion at: 10/14/2013 3:12:53 AM    

Your sample is too simple.
In case datasource has many columns and total width of columns greater than (Report.PageWidth - Report.Margins.Left - Report.Margins.Right) How can we show all of it on report?

Added By: Leon Zeng at: 9/19/2014 5:55:49 AM    

The example works fine.  However,
(1) It's better to use gridColumn's width, caption and fieldName
(2) When dataset has more than 1 table, the cells show empty. Below line fixes it:
               cell2.DataBindings.Add("Text", null, tableName + "." + columns[i].FieldName);  
(3) Could you please show example of sumary row/column as well?
E.g., lastcol = col5 + col6 + col7,
lastRow(col5) = sum(col5), etc.

GridView - How to implement a custom HeaderFilter with a calendar for a date column

$
0
0

This example illustrates how to create a custom HeaderFilter for a date column. The main steps are: 
1) create a custom HeaderTemplate using the  SetHeaderTemplateContent method to prevent default header filter button logic and implement a custom one;
2) use the PopupControl to display a Calendar and several additional filters. FormLayout is used to build  a layout;
3) use the MVCxClientGridView.PerformCallback  method to pass a command that custom filtering is required;
4) process a custom callback in the action method defined using the CustomActionRouteValues property and pass information about the current filter command to a partial view;
5) assign a delegate method to the BeforeGetCallbackResult property and implement the approach described in the ASPxGridView - How to programmatically change the column's filter in the FilterExpression  help article  to apply a new filter.

Click on the "Model Date" column to check how this works.

How to create a Stacked Line chart

$
0
0

The following example demonstrates how to create a DevExpress.XtraCharts.ChartControl with series of the StackedLineSeriesView  type, and add this chart to a form at runtime. Before proceeding with this example, first create a Windows Forms Application in Visual Studio, and include all necessary assemblies to the References list of your project.

Then, add the following code to the Form.Load event handler.

How to display KPI graphics in PivotGridControl bound to a regular data source

$
0
0

The following example shows how to display KPI graphics in PivotGridControl bound to a regular data source.

The PivotGridControl is bound to the "Sales Person" view in the Northwind database. To display KPI graphics, we create an unbound field whose values correspond to images contained within a KPI graphic set.

In this example, the unbound field values depend on the "Extended Price" field values: if the "Extended Price" field value is less than 100000, the unbound field value is "-1", if the "Extended Price" field value is less than 150000, the unbound field value is "0". In other cases, the unbound field value is "1".

The DataFieldUnboundExpressionMode property is set to DataFieldUnboundExpressionMode.UseSummaryValues to calculate unbound expressions for data fields against summary values. The KPIGraphic property specifies a graphic set used to visualize unbound field values.

Viewing all 7205 articles
Browse latest View live


Latest Images

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