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

How to register DevExpress scripts if an existing project has client libraries that use jQuery


How to merge cells horizontally in GridView via the CustomDrawCell event

$
0
0

This example illustrates an approach that is similar to that one described in the following thread: How to merge cells horizontally in GridView.
The mentioned functionality is implemented via the GridView.CustomDrawCell event handling.

In addition, this example illustrates how to implement merged text scrolling.


Question Comments

Added By: VikV at: 5/23/2014 1:55:46 PM    

There is a problem with this code.  Unfortunately, the width of the merged cell is incorrectly calculated once you start resizing grid.  So, everything looks fine when you first show the grid, but as you make the grid *smaller*, eventually lines and text next to the merged cells are overwritten/hidden.  This is visible if you set the background of your merged cells to a color.

The reason for this is that the calculations of the "textRect" involve e.Bounds and column.Width, which do not seem to be correct as the grid is resizing.  Instead, you need to use the grid's GridViewInfo to get the GridCellInfo, which will then give you the proper bounds for the cell(s).  I used this method and got my grid to correctly resize.

So in essence, the problem is with GridColumn.Width not correctly being the cell's width when making the grid smaller.  For some reason, making the grid bigger (horizontally) does not have a bad effect, only making it smaller.

Added By: Andrew Ser (DevExpress Support) at: 5/26/2014 5:22:45 AM    

Hello,
Thank you for the cooperation. We will take your corrections into account and update this example soon.

Added By: Bijal Patel at: 7/29/2015 10:25:44 AM    

Using this code sample I am able to successfully merge cells horizontally. But how do I unmerge those cells if the value in those previously merged cells is now empty.

Added By: Alexey Z (DevExpress Support) at: 7/29/2015 1:25:10 PM    Hello,

As I see, you have already created a separate thread - Merging cells data from two or more adjacent columns on the same row.. Let's continue our discussion there.

How to show detail information in a separate ASPxGridView

$
0
0

This example demonstrates how to use two ASPxGridView instances to show the master-detail data. Detail data is displayed in an external ASPxGridView when a master ASPxGridView's focused row index is modified.

MVC Version:
E3891: How to export multiple GridViews into a single print document

See Also:
E2529: How to show the ASPxGridView's detail information in the ASPxDataView
E1285: How to display master-detail tables in two grids on separate tabs of a PageControl
E2193: How to display detail data within a popup window

Question Comments

Added By: Robert Burgan at: 4/1/2015 12:31:34 PM    

I copied this code and added it to my grid. When I put a breakpoint at the Protected Sub gvDetail_CustomCallback sub, it does not reach it when I click the select button in the grid.

Added By: Larry (DevExpress Support) at: 4/1/2015 2:02:15 PM    Hello,

I have provided the answer for this issue in the ASPxGridView - How to show an additional information in second grid when the row is selected in the first one thread. Added By: DSJB at: 7/29/2015 8:56:46 AM    

Unless I am missing something the example code appears to have a bug. In the callback handler in the code behind, the first line should use the parameter supplied by the callback as follows:

string categoryId = gvMaster.GetRowValues(Convert.ToInt32(e.Parameters), "CategoryID").ToString();

Added By: Paul (DevExpress Support) at: 7/29/2015 2:00:51 PM    Hi,

Thank you for the report. It is possible to use both approaches, but our code doesn't require passing the focused row index to the PerformCallback function. We will update the example.

 DashboardDesigner - How to customize data source wizard to display only predefined data connections

$
0
0

This example demonstrates how to use the DashboardDesigner.DataSourceWizardCustomization to replace the default pages of the data source wizard with custom ones:

[C#]
dashboardDesigner1.DataSourceWizardCustomization=newDataSourceWizardCustomization();

 

We use following code to skip first page which allows selecting the data source type, and specify custom a wizard page that allows selecting one of the predefined connections. This custom page does not allow establishing a new connection:

[C#]
publicclassDataSourceWizardCustomization:IDashboardDataSourceWizardCustomization{publicvoidCustomizeDataSourceWizard(IWizardCustomization<DashboardDataSourceModel>customization){customization.StartPage=typeof(ChooseConnectionPage<DashboardDataSourceModel>);customization.Model.DataSourceType=DashboardDataSourceType.Xpo;customization.RegisterPageView<IChooseConnectionPageView,CustomChooseConnectionPageView>();}}

 

To specify default connections in code behind, use the DashboardDesigner.CustomDataConnections Property.  

Question Comments

Added By: mori khazaei 1 at: 7/29/2015 9:23:35 PM    

Hi,

I run this example. first no references is known and I add all again and then this error appear when I compile it:
'WizardCustomizationExample1.DataSourceWizardCustomization' does not implement interface member 'DevExpress.DashboardWin.ServiceModel.IDashboardDataSourceWizardCustomization.CustomizeDataSourceWizzard(DevExpress.DataAccess.UI.Wizard.IWizardCustomization<DevExpress.DashboardCommon.DashboardDataSourceModel>)'

The error is from DataSourceWizardCustomization1.cs line 49 column 18

how can I resolve this error?

How to remove standard bar items and add custom ones to the DocumentPreviewControl toolbar

$
0
0

This example demonstrates how to customize the DocumentViewerControl's toolbar (either BarManager or RibbonControl).

In particular, it shows how to remove standard commands from a Ribbon toolbar and add custom ones.

Question Comments

Added By: Julian Müller 1 at: 7/29/2015 10:54:25 PM    

This example works fine if the CommandBarStyle is not set to Bar!
How can I remove buttons from the toolbar when the CommandBarStyle ist set to Bar?

<dxp:DocumentPreviewControl Name="preview" CommandBarStyle="Bars">...

ASPxCardView - How to display master-detail data using two ASPxCardView controls

$
0
0
This example demonstrates how to use two ASPxCardView controls to display master-detail data.

ASPxGridView - How to refresh a master grid when a detail grid has been updated

$
0
0

This sample demonstrates how to update a primary grid data in response to changes made within a detail grid. By design, ASPxGridView can update its own rendering when processing a callback, but not the rending of outside controls. Thus, to refresh the main grid data, it is necessary to call the Refresh method when the detail grid data has been changed. Handle the detail grid EndCallback event handler for this. To overcome the circularity, also handle the BeginCallback event as follows:

[ASPx]
<ClientSideEventsEndCallback="OnEndCallback"BeginCallback="OnBeginCallback"/>
[JScript]
var command = "";function OnBeginCallback(s, e){ command = e.command;}function OnEndCallback(s, e){if(command == "ADDNEWROW"){ s.Refresh();}}


See also:
Automatically refresh the primary grid on changing secondary grid's data

Question Comments

Added By: Krzysztof Zak at: 7/30/2015 5:15:08 AM    

When we got error on post data then error message (below detail grid) appears and quickly disappears. My solution:

[ASPx]
<ClientSideEvents EndCallback="OnEndCallback" BeginCallback="OnBeginCallback" CallbackError="OnCallbackError"/>

[JScript]
var command = "";
var is_error = false;

function OnBeginCallback(s, e) {
   command = e.command;
   is_error = false;
}

function OnEndCallback(s, e) {
   if ((command == "DELETEROW" || command == "UPDATEEDIT") && (is_error == false)) {
       master_grid.Refresh();
   }
}

function OnCallbackError(s, e) {
  is_error = true;
}

How to bind the grid to Columns and Summaries specified in ViewModel

$
0
0
This example shows how to put columns and data summary definition logic in the ViewModel and setup the Grid Control.

How to use ASPxRichEdit to edit RTF data in ASPxGridView's EditForm

$
0
0
This example is based on the How to use ASPxHtmlEditor to edit RTF data one. It illustrates how to accomplish the same task using a new ASPxRichEdit control instead of the ASPxHtmlEditor one:
- Add ASPxRichEdit into the related column's EditItemTemplate;
- Handle the ASPxRichEdit.Init event.
- When editing an existing row, use the corresponding ASPxRichEdit.Open method overload;
    - Pass the documentId value to identify the document to open (for example, generated based on the editing row key/guid);
    - Return a stream or an array of bytes value from the 3-rd parameter created from the underlying column value;
- Handle the ASPxGridView RowInserting/RowUpdating events:
    - Retrieve the modified rich text content from ASPxRichEdit via the ASPxRichEdit.SaveCopy method;
    - Save it back to the database in the required format (a string or an array of bytes value).

Note that data modifications are not allowed in online demos. To allow editing in local/offline mode, download the example and comment out the "throw..." operation in the ASPxGridView.RowUpdating event handler.

See Also:
How to use ASPxHtmlEditor to edit RTF data

How to support the ISearchControlClient interface for TileControl to use SearchControl with it

How to implement the ISearchControlClient interface

$
0
0

We have SearchControl (added in v14.1), which provides the search and filter functionality for the attached object. SearchControl can be attached to objects that support the ISearchControlClient interface. You can find a list of our controls that support this interface out of the box in the SearchControl help topic.
However, this list can be extended by your own. This example illustrates how to implement the ISearchControlClient interface for a Form for searching and highlighting controls by their names.

To introduce the ISearchControlClient interface into your project, implement the following members:
 - SetSearchControl - this method is invoked when you attach/detach your object from the SearchControl.Client property.
 - IsAttachedToSearchControl - this property determines whether your object is attached to SearchControl.
 - ApplyFindFilter - this method is invoked when filtering is performed. Here you need to implement your own logic for filtering.
 - CreateSearchProvider - this method must return SearchControlProviderBase's descendant. This provider contains SearchText and FilterCondition obtained from the RepositoryItemSearchControl.FilterCondition property.
It is necessary to override the SearchControlProviderBase.GetCriteriaInfoCore method to return SearchInfoBase's descendant. This instance should contain all required information for your filtering. It is passed to the ApplyFindFilter method as a parameter.

See also: 
How to support the ISearchControlClient interface for TileControl to use SearchControl with it

How to use the built-in caching functionality of the ASP.NET MVC Document Viewer

$
0
0

This example illustrates how to make the DocumentViewer store its document on the client between postbacks.

When the Document Viewer extension performs a callback to the server (for example, when a page is changed), the report document is restored from the cache. So, it is not necessary to recreate a report document and data is not retrieved from the database. The Document Viewer manages a cached document by using the CacheReportDocument and RestoreReportDocumentFromCache delegates.

Note that in case of using this approach, it is necessary to move your report data binding code to its DataSourceDemanded event handler.

 

To learn how to accomplish this task in ASP.NET WebForms, see the following code example: How to use the caching functionality of the Document Viewer

Question Comments

Added By: Felix Zamora at: 7/30/2015 11:25:50 AM    

Its a excellent example. But How would the same example with Report Designer?

Document Layout API - Practical usage

$
0
0

This example demonstrates how RichEditControl's DocumentLayout API can be used to collect information about a currently clicked document element (as well as its parent elements):
Layout API

Depending on the type (text block, image, table cell, textbox, etc.) of a clicked element, the following information can be analyzed:
content, content bounds, position on a page, page bounds, current page index, a number of images/textboxes on a page, common text blocks count, etc.


In this example, different approaches are used to get layout information about a current element:
- Use the DocumentLayout.GetElement and DocumentLayout.GetElement[T] methods;
- Use the LayoutIterator class;
- Use a custom LayoutVisitor descendant.

To get layout information about the current element, set the caret inside a text block or table cell (or select an image) and click the "Analyze a current document layout" button.

Question Comments

Added By: Shafeeq Weera 1 at: 7/30/2015 2:29:52 PM    

Hi I am using the Rich Edit Document Server, I have no controls to click on, all has to be done in code.
The documentation at https://documentation.devexpress.com/#DocumentServer/CustomDocument15306 is also referring to methods on the Richedit control. Is there a way to access the functionality through the document server elements?

ASPxGridView - How to populate a combobox column dynamically based on a row index in Batch Edit mode

$
0
0

The attached example illustrates how to populate GridViewDataComboBoxColumn at runtime when ASPxGridView is used in Batch Edit mode.

The technique of completing this task in a batch grid differs from the approach used for a grid in standard mode. When the grid is used in Batch edit mode, ASPxGridView performs all operations on the client side. Therefore, it's not possible to populate the combo box located in each row using the CellEditorInitialize event handler.
As a solution, the combo box can be populated on its callback.
This scenario requires the following steps:
1) Add the combo box' Callback event handler in the grid's CellEditorInitialize event handler.
2) Initiate a callback to the combo box by calling its PerformCallback method in the client-side ASPxClientGridView.BatchEditStartEditing event handler. Pass a row's visible index obtained via e.visibleIndex as a parameter of this method.
3) Add required items to the combo box in its server-side Callback event handler. You can get the current row index from the callback parameter (e.Parameter).

Question Comments

Added By: Cheung Wai Shing at: 7/30/2015 10:41:03 PM    

Hi. I have try this sample.  It seems got problem when press the new button.

Added By: Larry (DevExpress Support) at: 7/30/2015 11:22:59 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T273448: T190978 example - Incorerct index is shown when clicking the new button. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to implement the Copy/Paste feature

$
0
0

This example demonstrates how to parse the clipboard's data to paste rows into the grid.
For more information, please see the following KB article: A1266

See Also:

How to implement the paste from clipboard feature

Question Comments

Added By: Joe Isaac at: 2/12/2015 10:23:53 AM    

Is this still the method I should follow for the latest version of the winforms gridcontrol?

Added By: Sasha (DevExpress Support) at: 2/13/2015 12:00:59 AM    

Hello Joe,
Yes, use this example to implement the copy/paste feature.

Added By: Chris D at: 7/31/2015 12:37:04 AM    

Dear,

i need to do this with all my gridviews with datasource XPCOLLECTION, what do i have to do ?
Thanks for your support!


How to export a document with AcroForm data

$
0
0
This example shows how a PDF document with AcroForm data (interactive forms) can be exported to an XML format.

You can also export the AcroForm data document to FDF, XFDF, and TXT formats using the approach described below.

How to generate a live report based on GridControl content

$
0
0

This example demonstrates how to use the Snap Control facilities to generate an "editable" report based on GridControl content.
The SnapControl provides a corresponding API to generate a SnapDocument layout at runtime, including creating master-detail lists, grouping, sorting, etc. 
How to generate a document layout in code via the Snap application programming interface (API)

The main benefit of using the SnapControl component to generate GridControl's report is that an end-user operates with a "live" editable document, whose layout can be customized like a regular Word document, and all changes made in a document layout are immediately applied to current report content (report data).


To build the solution demonstrated in this sample into an existing application, copy the "SnapReportForGridGenerator" and "SnapReportFormGenerator" files into your project and use a corresponding extension method to generate a Snap report for current GridControl data:

[C#]
gridControl1.ShowSnapReportPreviewForm();

Take special note that this approach requires adding corresponding assemblies into your project.

The following video demonstrates how to customize a generated SnapDocument at runtime, save all changes made at runtime in the SNX format and restore them on further generating a report:

An extended version of this video (which also demonstrates how to display headers for each master row) is available (is built-in) in C# and VB solutions of this example (the "Snap_Report_Customization.swf" file).
A key point is that any changes made in the SnapDocument affect only a current record template. To apply the changes for a whole document, you need to force updating all SnapList records in the document.
The simplest solution to achieve this is to click a record next to the currently edited one.

P.S. This approach has the following limitations:
1. In case of a large amount of data (a large number of records in the GirdControl view), there can be performance issues on rendering and calculating the layout of the SnapControl document.
2. The SnapControl does not support Server Mode data sources.

How to create the MVVM DockLayoutManager using LayoutAdapter

How to show a complex property value in DataItemTemplate of a column

$
0
0
This example demonstrates how to show a complex property value in DataItemTemplate of a column using BindingExpressions

How to import AcroForm data from XML

$
0
0

This example demonstrates how you can import AcroForm data  (interactive forms) from XML format  to a PDF document.

You can also import the AcroForm data from FDF, XFDF, and TXT formats as described below.

Viewing all 7205 articles
Browse latest View live


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