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

How to dynamically generate a report with a parametrized SQL query as a data source

$
0
0

Description:
 I need to implement a generic kind of web report viewer to display the result of my SQL query, which accepts some parameters.

Solution:
 This can be done by creating an XRTable control dynamically.

To pass a table name (which is a query parameter), you can use a query string variable. As a result, you can pass the "TableName" parameter as follows:
http://hostname/PassSQLQuery/ReportViewer.aspx?TableName=Customers.

Then, the XtraReport code-behind methods will populate data using the SQL query, which returns all the table rows from the table.
In the final step, an XRTable control is created, and gets bound to the column names of the data table.

Question Comments

Added By: Krishna Raj 1 at: 8/27/2015 12:06:02 AM    

I have tried the below sample to my current project using dataset as the binding source but got the blank report at the end.

Added By: Vasily (DevExpress Support) at: 8/27/2015 1:56:13 AM    

Hello Krishna,

To process your recent post more efficiently, I created a separate ticket on your behalf: T282890: How to dynamically create a report in an ASP.NET Web Forms application. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Basil Kadara at: 11/4/2015 9:52:24 PM    

Hi ,

i want to deign the report and bind only the values at run time , because it is difficult to align the controls during run time.

is there a way to place the controls during design time and just bind the values at run time in asp.net web application.

Added By: Jannet (DevExpress Support) at: 11/4/2015 11:21:43 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T308234: How to place the controls during design time and just bind the values at run time in asp.net web application. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.


How to style GridControl's summary items separately when summary items are aligned by columns

$
0
0

Starting with v16.1, TableView provides the following properties, which allow you to style each GridControl's summary item separately:
1. FixedTotalSummaryElementStyle

2. TotalSummaryElementStyle

3. GroupColumnFooterElementStyle

4. GroupColumnSummaryElementStyle



For versions 15.2 and older, when group summary items are aligned by columns, it is necessary to use the TableView's GroupColumnSummaryItemTemplate property to style GridControl group summary items.
The main idea of this approach is to define a custom ItemsControl inside the GroupColumnSummaryItemTemplate, bind its ItemsSource property to the collection of group summaries and show summary items as child ItemsControl elements. To customize summaries you can use ItemsControl properties, for instance, ItemTemplateSelector.

Question Comments

Added By: Tarun Goswami at: 5/14/2015 9:49:00 AM    

Thanks for this, COuld you please let me kno How could i assign TextDecoraton property for GroupedRow?

Added By: Alexander S (DevExpress Support) at: 5/14/2015 10:24:34 AM    

Hi Tarun,

To process your recent post more efficiently, I created a separate ticket on your behalf: T242030: How to apply TextDecorations to group rows. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to: Apply metadata to PropertyGridControl's select object by using MetadataExtendedSource dynamically

$
0
0
This example demonstrates how to apply metadata to PropertyGridControl's select object by using MetadataExtendedSource dynamically

GridView - A simple implementation of 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 .

Web Forms: 
ASPxGridView - How to implement cascading comboboxes in Batch Edit mode

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 .

MVC:
GridView - A simple implementation of cascading comboboxes in Batch Edit mode

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.

ASPxGridView - Batch Editing - How to conditionally enable and disable the editing on the client side

How to use a custom editor for editing in the PropertyGridControl.

$
0
0

This example demonstrates how to use a custom editor for editing in the PropertyGridControl.

This task can be completed in the following ways.
1. Use a custom UITypeEditor. For this, create a custom UITypeEditor descendant and mark a property of a corresponding object with the System.ComponentModel.Editor attribute in the following manner:

[C#]
publicclassFile{[System.ComponentModel.Editor(typeof(UIEditors.FilteredFileNameEditor),typeof(System.Drawing.Design.UITypeEditor))]publicstringPath{get;set;}

 Please refer to the UITypeEditor Class article for more information.

2. Assign a ButtonEdit to a cell as shown in the Assigning Editors to Editor Rows  article and handle its ButtonClick event.

How to customize the default Find Panel filtering algorithm

$
0
0

Find Panel uses an extended syntax that allows you to specify complex criteria. You can find detailed information here:
- Find Panel

However, sometimes it is necessary to exclude/include some rows in the resulting list according to your custom logic. In this case, you can filter rows manually by handling View.CustomRowFilter Event. This example demonstrates how to construct your own filter criteria and use ExpressionEvaluator to check whether a row should be hidden.

For demo purposes, this example just shows how to find exact matches of a typed string. The same result can be accomplished with the default behavior if you enclose your text in double quotes in Find Panel. To provide your own logic, just modify the MyConvertFindPanelTextToCriteriaOperator method as your needs dictate.

Question Comments

Added By: Sigol at: 9/6/2012 2:34:45 PM    

In the text above "if you enclose your text in commas in Find Panel" I think should read "if you enclose your text in DOUBLE QUOTES in Find Panel".

Added By: Arnaud Chevallier at: 12/21/2012 5:35:48 AM    

This may be usefull, as for example replacing parenthesis by double quotes. However with this method the results are not highligted anymore. Is there any workaround ?

Added By: Mu XU at: 7/17/2013 8:19:11 AM    

can't resolve DxFtsContainsHelperAlt in dx 11

Added By: Catalin Zainescu at: 12/21/2015 4:07:00 PM    

The suggested workaround feels more like black magic... For example, can you guarantee that "ColumnView.GetFindToColumnsCollection" method will always be there?

Do you have any plans to add an option to change this default filtering behavior? At the very least, it would be really nice to be able to switch from "OR" to "AND" filtering logic instead of having to add "+" to every token.

Added By: Nikita (DevExpress Support) at: 12/22/2015 6:41:18 AM    

Hello Catalin,

I understand that this example a quite complex. And while we really cannot guarantee that we won't change the GetFindToColumnsCollection method, we do guarantee that we will keep this example in the working state. So, if we change some grid code, which will break this example, we will upload a new version of this example to the site. 
I also understand that such functionality is useful, so we are going to consider introducing similar functionality in the future. 

Added By: rouzzi anissa at: 8/16/2016 2:42:33 AM    i want to customise my search in the find panel( i want to switch from "OR" to "AND" filtering logic) but i didn't understand this example?Could you please attach an  example with grid view .Thx a lotAdded By: Svetlana (DevExpress Support) at: 8/16/2016 3:03:30 AM    

Hello,

I've created a separate ticket on your behalf (T415372: How to customize search in Find Panel). It has been placed in our processing queue and will be answered shortly.


How to localize a DevExtreme application using Globalize v1.X

How to: Create a wizard based on a collection of view models

How to: Use the WizardService

How to: Create a Wizard with pages defined in XAML

$
0
0

This example demonstrates how to create a simple Wizard with predefined pages. There are three built-in page types:
WelcomeWizardPage
WizardPage
CompletionWizardPage
These pages have the same functionality, and only their button and content region visibility settings are different. 
To show/hide page buttons, use the following properties:
-ShowBack
-ShowCancel
-ShowFinish
-ShowNext
To enable/disable page buttons, use the Allow[Back|Cancel|Finish|Next] properties.

See also:
How to: Create a wizard based on a collection of view models
How to: Use the WizardService

How to drag columns to GridControl from an external source

$
0
0

To drag columns from an external source (e.g., ListBox) it's necessary to determine the behavior of the TableView when columns are dropped onto it. To do this, create custom DropTargets and assign them to visual elements by overriding our theme resources.

How to insert, edit and delete data in a DataTable by using ASPxGridView at runtime when data is stored in Session

How to insert, edit and delete data in a DataTable by using ASPxGridView at runtime when data is stored in ViewState

$
0
0

This example shows how to insert, edit and delete data in a data table by using ASPxGridView. The data table and the grid are created at runtime.
To be able to store data in ViewState, the ASPxGridView.EnableCallBacks property should be set to False. Refer to the K18387: The Concept of Callbacks article for additional details.

See Also:
KA18686: ASPxGridView - How to implement CRUD operations with a custom data source
T191009: How to insert, edit and delete data in a data table by using ASPxGridView at runtime when data is stored in Session
Editing an in-memory dataset


GridView - Batch Editing - How to conditionally enable and disable the editing on the client side

How to populate GridControl using UnboundDataSource (UnboundSource)

$
0
0
This example shows how to use the UnboundDataSource class (a WPF wrapper for the UnboundSource class).

How to use OData (WCF Data Services) to provide data for a report

$
0
0
At the moment, XtraReports cannot connect to an OData data source directly. 

Our reporting tools, however, are data source agnostic and support data sources of different types including .NET data providers, lists (implementing the System.Collections.IList, System.ComponentModel.ITypedList, or System.ComponentModel.IBindingList interface), and XML data sources. To learn more, refer to Data Binding Approaches.

So, to provide report data through the OData service, get IList data from the OData Service and then pass it to a report. Here are implementation details.

1. Add the OData Service Reference to your project. Now, the OData service context is registered in the application. See the Calling an OData Service From a .NET Client (C#) article for details.
2. Create a data model from the OData Service context. This data model will retrieve data from the OData service and return IList data.

Please note that OData defines query options that can be used to filter, sort, page data, and so forth. For more details, see the LINQ Considerations (WCF Data Services) topic on MSDN.

3. Bind a report to this data model through the ObjectDataSource component. Please note that it is necessary to retrieve actual data from a custom object data source. Please refer to Retrieve the Actual Data.

See also: Using the Web Service as an XtraReport.DataSource

Question Comments

Added By: MichaelG at: 8/16/2016 11:55:27 PM    Will this feature be possible in the future ?
Will it be possible to get report data via an odata service directly in report designer with the query builder anytime?


Added By: Jannet (DevExpress Support) at: 8/17/2016 12:20:33 AM    

Hello,

I've created a separate ticket on your behalf (T415788: Will it be possible to get report data via an odata service directly in report designer with the query builder anytime). It has been placed in our processing queue and will be answered shortly.

How to implement custom WinPropertyEditor based on the ListBoxControl

$
0
0

Scenario

This example illustrates how to implement a custom WinPropertyEditor with ListBoxControl to edit reference properties in DetailView:


Steps to implement

1. Add a new class inherited from the WinPropertyEditor as shown in the Module.Win\Editors\CustomListBoxEditor.xx file.

This editor is inherited from WinPropertyEditor not to configure data bindings manually.
2. In the Model Editor, set the PropertyEditorType attribute to the custom editor type for a required reference property node, as shown in the example's Model.XAFML file.

Important notes
1. ListBoxControl
cannot correctly work with the ImmediatePostData property, because it does not contain the SelectedItemChanged event. Without this event, ListBoxControl does not send a notification to the binding mechanism when item selection is changed. This behavior was inherited from the default ListBox control. To avoid this behavior, subscribe to the ListBoxControl.SelectedIndexChanged and send notifications to the binding manually as shown in the Module.Win\Editors\CustomListBoxEditor.xx file .

2. This editor is designed to work only in DetailView.

See also:

How to: Implement a Property Editor Based on a Custom Control (Windows Forms)

Question Comments

Added By: FSuster at: 11/20/2013 1:36:34 AM    

Thanks for this usefull example. Maybe I found a bug.

This is the scenario: TestItem has a n:1 association to CategoryItem
Several CategoryItems are already saved as well as an object of the type TestItem. For this TestItem a specific CategoryItem was selected. In the TestItem's detail view the CategoryItems are displayed as a CustomListBoxEditor.

1. Open the existing detail view of the TestItem. The right value in the CustomListBoxEditor is selected.
2. Close the detail view.
3. Reopen the detail view. Now the first item of the CustomListBoxEditor is always selected, no matter what CategoryItem was saved in the TestItem.
==> The binding of "SelectedItem" only works once.

Greetings,
Stefan

Added By: Dennis (DevExpress Support) at: 2/17/2014 5:02:39 AM    

Thank you for your feedback, Stefan. We will answer you in the https://www.devexpress.com/Support/Center/Question/Details/Q571657 ticket you created.

Added By: Gilles Brice Mahabo at: 8/17/2016 1:02:06 AM    Hello guys,

I use your solution to implement  a custom WinPropertyEditor based on the ListBoxControl.
My property have a DataSourceProperty but when I use the custom WinPropertyEditor based on the ListBoxControl, it displays all the objects (of the property type) and not the objects of te DataSourceProperty.

How can I fix this please ?

Best regards,
Gilles

Added By: Alexey (DevExpress Support) at: 8/17/2016 1:05:50 AM    

Hello Gilles,

I've created a separate ticket on your behalf (T415811: E4890 with DataSourceProperty). It has been placed in our processing queue and will be answered shortly.

How to get all images provided by the DevExpress Icon Library

$
0
0
The following example demonstrates how to get information about file names and images, stored in the DevExpress Icon Collection.
Question Comments

Added By: Rennie Petersen at: 6/3/2016 3:54:19 PM    For what it's worth, here's an alternative version that retrieves all of the icons in one run.

[C#]
usingSystem;usingSystem.IO;usingDevExpress.Images;namespaceGetIconLibrary{classProgram{staticvoidMain(string[]args){stringfilePathRoot=@"E:\Icons\DevExpress Icon Library\";foreach(ImagesAssemblyImageInfoimageInfoinImagesAssemblyImageList.Images){stringimageType=imageInfo.ImageType.ToString();stringimageSize=imageInfo.Size.ToString();stringfilePathSpecific=Path.Combine(filePathRoot,imageType,imageSize);if(!Directory.Exists(filePathSpecific)){try{Directory.CreateDirectory(filePathSpecific);}catch(Exceptione){Console.WriteLine("Can't create a directory: {0}",e.ToString());}finally{}}using(Streamstr=ImageResourceCache.Default.GetResourceByFileName(imageInfo.Name)){if(str!=null&&str.CanRead){using(FileStreamfileStream=File.Create(filePathSpecific+"\\"+imageInfo.Name)){str.CopyTo(fileStream);Console.WriteLine("Writing "+imageInfo.Name);}}}}}}}



Added By: Alisher (DevExpress Support) at: 6/6/2016 1:01:20 AM    Hi Rennie,

Thank you for sharing your implementation with us. We greatly appreciate this.Added By: Don Boitnott at: 8/17/2016 5:16:54 AM    You need to change the call to GetResourceByFileName() to include the ImageType:

using (Stream str = ImageResourceCache.Default.GetResourceByFileName(imageInfo.Name, imageInfo.ImageType))
 
...otherwise, you get an incomplete (and seemingly random) set of images.
Viewing all 7205 articles
Browse latest View live


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