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

How to use a third-party jQuery plug-in (accordion) in a DevExtreme application


How to Format Cell Values

$
0
0

The following example shows how to format data that corresponds to 'Quantity' and 'Unit Price' data fields in a sample ASPxPivotGrid control.

For the 'Quantity' field the PivotFieldBase.CellFormat property is used to format data in a custom manner. Values that correspond to this field are enclosed with round brackets. The formatting settings specified by the PivotFieldBase.CellFormat property also affect the representation of total and grand total cells.

The 'Unit Price' field is bound to a field that contains currency data. By default the cell values that correspond to such fields are formatted as currency amounts (the formatting settings are determined by the regional settings). For English (United States) culture the currency values are represented using two digits to the right of the decimal point. In the example, the PivotFieldBase.GrandTotalCellFormat property is used to format grand total cell values for the 'Unit Price' field in a different manner. The data in these cells is formatted as integer currency values (without fractional portions).

Example Comments

Added By: Alan Gali Dev at: 12/20/2012 10:42:00 AM    

how can I extend this to apply to entire pivotgrid? I would like all data cells with numeric values to have default formatting of N2 for example.
I'd prefer to not have to loop through all the fields of the pvg as they may be too many

Added By: RiqueCosta at: 8/6/2013 3:32:13 PM    

getting error at online demo http://codecentral.devexpress.com/E1874/

Added By: Andrew Aks (DevExpress) at: 8/7/2013 6:40:37 AM    

We already fixed this problem. Please try running this demo again.

How to create ASPxPopupControl at runtime

$
0
0

This example illustrates a simple way in which to create an ASPxPopupControl at runtime.

ASPxGridView - How to initialize an Edit Form editor based on a separate column value

How to bind ASPxScheduler to MS SQL Server database

$
0
0

This example demonstrates how to bind the ASPxScheduler control to a database located at MS SQL Server 2005. The project includes the CarsXtraScheduling.sql file which contains data table scripts. Sample data are attached in the sql_data.sql file, containing INSERT statements which can be executed to generate the data.

See Also:
E1450
K18043
E261
E409

How to implement customized PercentOfRow/PercentOfColumn

$
0
0

This example demonstrates how you can access values of other cells to calculate the current one, by handling the CustomCellDisplayText event. This is an alternative implementation of PercentOfRow/PercentOfColumn totals. Since version 8.3 this functionality is provided in our pivot grid out-of-the-box.

TreeList - How to populate TreeList from a database in virtual mode and implement the drag-and-drop functionality

$
0
0

Virtual mode is useful if there's a lot of data and it's not necessary or impossible to create a tree at once. To implement virtual mode for the TreeList extension, a specifically parameterized BindToVirtualData method can be used. The method's parameters refer to delegate methods that can be declared as static within a model class. For this, a special TreeListVirtualModeHelper class with the required methods was created. To implement the drag-and-drop functionality, it's necessary to define the SettingsEditing.NodeDragDropRouteValues property.

Note that node dragging is an editing operation, because while changing the node's position, its parent row identificator changes. The MoveNode method was created to accept changes on the controller.

How to create a custom ASPxGridView's filter insensitive to the number of spaces and punctuation

$
0
0

This example shows how to apply a custom filter to the text in the Auto Filter Row editor.

When the ASPxGridView.ProcessColumnAutoFilter event is raised before the filter criterion is applied, we parse the ASPxGridView.FilterExpression and take only a custom filter for the current column using the FindAndRemoveCustomOperator function.

In the MergeCriterias function, we make a custom criterion and then apply it.

When the AutoFilterCellEditorInitialize event is raised, we get a custom filter for a certain column from the FindAndRemoveCustomOperator function and pass it to the Auto Filter Row editor.

See also:
How to register a custom filter function and use it in ASPxGridView


How to integrate a charting module - example solution

$
0
0

This solution includes ready-to-use project templates for the KA18738KB article.

How to create a custom RangeTrackBarControl with multiple tick marks.

$
0
0

Sometimes it is useful to have the capability to edit multiple ranges using a single control. This can be introduced with a custom control – MultipleRangeTrackBar.

In this example we have implemented the following features and functionality:

1) The capability to have multiple tick marks within this control.

2) The EditValue property of this control is a special RangeListclass which contains a list of TrackBarRange instances.

3) A couple of methods are intended for adding, changing and removing ticks:

- AddNewRange(int minimum, int maximum) – add a new range at a specific position. If it intersects with one of the existing ranges it will not be created.

- AddNewRange() – add a new range at the (0, 0) position. It has the same behavior as the previous method.

- ChangeValue(int minimum, int maximum, int index) – changes the value of the thumb by a particular index in the EditValue’s list. The new value will be set to a new TracKBarRange object with a special minimum and maximum. If it intersects with one of the existing ranges it will not be changed.

- ChangeValue(TrackBarRange range, int index) – The new value will be set to the range parameter. It has the same behavior as the previous method.

- RemoveRange(int index) – removes the thumb, by a particular index in the EditValue’s list. The first range cannot be deleted. Calling this method with the 0 parameter will do nothing.

4) The new EditValueChanged and the EditValueChanging events fire after successful completion of any of the above methods. They also fire after changing the EditValue with a new RangeList instance.

5) The Intersect event with the IntersectEventArgs argument. Thumbs cannot be intersected in this control. When an end-user tries to intersect thumbs, this event is raised. This event allows you to specify whether or not a dragged thumb is about to be intersected. The event handler receives an argument of type IntersectEventArgs containing data related to this event:

- DraggedThumb – gets the index of the pair of ticks.

- ThumbType – gets the value of the ThubmType type that specifies the type of the dragged thumb (ThumbType .Maximum or ThumbType .Minimum).

- Value – gets the value where this intersection occurs.

6) The ThumbsCount property returns the number of thumbs.

7) A new method also was added:

GetValue(int index) – returns a TrackBarRange instance, which has a particular index in the EditValue list.

     The current example shows how we implemented MultipleRangeTrackBar and how to use it.

How to bind ASPxScheduler to ObjectDataSource

$
0
0

In this example, the ObjectDataSource control is used to bind the ASPxScheduler control to middle-layer business objects. Further, you can implement your own custom CRUD-operations (Create, Read, Update, Delete – a common abbreviation for data operations) using an arbitrary data provider.

To make the project simple and easy-to-use, data is written into a session.

See Also:
How to bind ASPxScheduler to ObjectDataSource
How to bind ASPxScheduler to MS SQL Server database
How to bind ASPxScheduler to XPO via the Unit of Work
How to bind ASPxScheduler to SyBase ASE 15 database

How to build a bridge between chart and pivot grid: Extended version

$
0
0

Note: This example applies to an XtraCharts version prior to v2010 vol 2. Starting from v2010 vol 2, after you assign a Pivot Grid instance to your chart's DataSource property, all the chart's bindings and layout settings are automatically adjusted. For more information, please review theS90521: Improve the interaction between the XtraCharts and XtraPivotGrid controls report and E1237: How to link a chart to the PivotGridControl example.

This example is an extended version of the E284 example. Due to numerous client requests regarding this functionality, we've decided to create a complete sample project, visually demonstrating different ChartControl-PivotGridControl relation approaches.

How to embed TreeList control to a report at runtime

How to insert text between two bookmarks

How to concatenate values of several RTF fields to display the resulting RTF content in a single XRRichText control

$
0
0

Problem:
I am creating a data-aware report. The source data table has several columns containing RTF text. I need to concatenate the contents of these columns and display it in a single XRRichText.

Solution:
As you probably know, RTF strings cannot be concatenated directly (strResult = strSource1 + strSource2) because it will result in invalid RTF content. Instead, utilize special RTF-aware API to accomplish this task. Our XtraRichEdit Suite provides you with this API. In v2011 vol 1 we have implemented the non-visual RichEditDocumentServer component (in previous versions use the RichEditControl Class instead). You can use its RtfText property and Document.AppendRtfText() method (see the SubDocument.AppendRtfText Method). Thus, handle the XRRichText.BeforePrint event, obtain current RTF field values via the XtraReportBase.GetCurrentColumnValue Method, concatenate them by using the aforementioned API and assign the resulting RTF to the XRRichText.Rtf Property.


How to bind ASPxScheduler to XPO via the Unit of Work

$
0
0

This example illustrates how you can bind the ASPxScheduler control to an XPO (eXpress Persistent Objects) data source using the UnitOfWork session class.
Two persistent object classes are defined - one for appointments, the other - for resources. They are named Task and Employee. Two XPO data sources are added to the page.
The ASPxScheduler.AppointmentsInserted, ASPxScheduler.AppointmentsChanged and ASPxScheduler.AppointmentsDeleted events are handled to commit changes in the data source. They call the UnitOfWork.CommitChanges method of the Unit of Work object for this purpose.
To obtain a correct appointment, a new XPORowInsertionProvider class is defined. It is aimed at retrieving the key identifier value of the last inserted appointment, and set the corresponding value of the appointment in the storage. It handles the Session.ObjectSaved event of the Session object and the ASPxScheduler.AppointmentsInserted event of the ASPxScheduler.

Note: an exception occurs when trying to drag and drop the recurring appointment. This is a known issue which is fixed in example code designed for XPO versions v2008 vol.3.3, v2009 vol1 and higher.

See Also:
How to bind ASPxScheduler to ObjectDataSource
How to bind ASPxScheduler to MS SQL Server database
How to bind ASPxScheduler to SyBase ASE 15 database

How to override RTF formatting in XRRichText

$
0
0

Problem:
I am creating a data-aware report. The source data table has a column containing RTF text. I need to override several RTF settings before displaying it in XRRichText. I have tried many properties including the following but it does not work for me:

XRRichText.ForeColor
XRRichText.Font
XRRichText.TextAlignment

Solution:
The approach of modifying the RTF setting directly via the XRRichText properties will not help you achieve the desired result. The RTF format supports complex formatting for different content parts and it is impossible to manage corresponding format settings in this manner. We have already discussed this topic in detail in the following threads:

XRRichText - Font settings aren't applied correctly
XRRichText text alignment
Bold Text in XrRichText
XRRichText Default Font
rtf font override

The correct solution is to utilize special RTF-aware API. Our XtraRichEdit Suite provides you with this API. In v2011 vol 1 we have implemented the non-visual RichEditDocumentServer component (in previous versions use the RichEditControl Class instead). This example illustrates how this component can be used to override RTF formatting and even append arbitrary content to the source RTF (see the XtraReport1.ApplyRTFModification() method).

See also:
How to concatenate values of several RTF fields to display the resulting RTF content in a single XRRichText control

How to use ASPxGridLookup in multiple selection mode as the ASPxGridView editor

How to handle a specific event within a whole document object and handle keyboard pressing

$
0
0

This example illustrates how to:
- Handle a specific event (for example, "keydown") within a whole document object;
- Perform a specific action when a specific keyboard key (for example, ESC) is pressed.

The client-side ASPxClientUtils.AttachEventToElement method allows for attaching a handler to the "keydown" event over the "document" object.

ASPxButton.aspx:
Clicking the "Escape" key calls the client-side ASPxClientButton.DoClick method and invokes the custom alert message to inform an end-user of the clicked key.

ASPxPopupControl.aspx:
Clicking the "Escape" key hides ASPxPopupControl via the client-side ASPxClientPopupControl.Hide method.

How to reorder ASPxNavBar groups

$
0
0

This sample illustrates how to change the order of groups at runtime by means of custom buttons integrated in the GroupHeaderTemplate.

Viewing all 7205 articles
Browse latest View live


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