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

How to display and export more than 3 KPI images ( Display a custom image within a cell )

$
0
0

The easiest way to accomplish this task is to use few different ButonEdits to represent data. You need to hide the editor default button and add an image button instead. Then you can choose which editor to show via the PivotGridControl.CustomCellEdit event. Finally set the PivotGridFieldOptionsEx.ShowButtonMode property to ShowAlways to show all buttons by default.

By default ButtonEdit is not printed with buttons. It is necessary to create a custom ButtonEdit descendant to export a button image.


How to colorize series point markers in colors stored in a data source

$
0
0
This example demonstrates how to colorize series point markers in colors stored in a data source.

How to colorize series point markers based on keys associated with points

$
0
0
This example demonstrates how to colorize series point markers based on keys associated with points.

dxFileUploader - How to implement a file preview

$
0
0
This example illustrates how to implement a file preview. The main idea is to define the onValueChanged handler which provides selected files as an array of File objects. So, it's possible to use File API to read information about selected file(s).

How to colorize series point markers based on range values

$
0
0
This example demonstrates how to colorize series point markers based on range values.

How to disable operations with appointments (editing, dragging, resizing) depending on a current user (an appointment's owner)

$
0
0

The base idea of a demonstrated approach is to store an appointment's owner (user) as an additional appointment's custom field.
This field value is stored automatically with a newly created appointment in the ASPxScheduler.AppointmentInserting event handler.

After that, this field value is passed from a server to a client (using the ASPxScheduler.InitClientAppointment event handler) and all operations with appointments are disabled depending on this property value in the ASPxScheduler.PopupMenuShowingASPxClientScheduler.AppointmentDropASPxClientScheduler.AppointmentResize event handlers.

In this example, a current user can be selected from a combobox located on the top of the ASPxScheduler.
Appointments that cannot be edited by a current user are rendered with a "gray" background.

How to export the GridControl into a native Excel table

$
0
0

In this example, we demonstrate how to export data from the GridControl into a native Excel table. Exporting data into a native Excel table provides greater capabilities for data analysis and management, and allows you to format cells using numerous formatting options. To enable this export mode, set the XlsxExportOptionsEx.LayoutMode property to "Table".
When exporting to a native Excel table, you can handle the BeforeExportTable event to customize the settings of the created table.

How to calculate an aggregated summary function

$
0
0

This sample illustrates how to calculate aggregate functions in a report. This is done without writing any code, by assigning an expression to a calculated field.



In this example, the same condition is used both to calculate the number of appropriate entries and highlight these fields in the report document (by using formatting rules).

For a step-by-step tutorial illustrating how to solve this task, see the following document online: How to: Calculate an Aggregate Function.

See alsoHow to use aggregate functions in Calculated Field expressions


Synchronizing with Google Calendar

$
0
0

This example illustrates how to use Google Calendar API to synchronize ASPxScheduler with Google Calendar. Google provides the corresponding guidelines regarding the use of this API:

Google Calendar API 

Before using this API, make certain you have read and are in compliance with Google’s licensing terms. Next, you’ll need to generate a JSON file with OAuth 2.0 credentials to enable the Google Calendar API.


We have a corresponding KB article which contains a step-by-step description of how to generate this JSON file for the installed application type:

How to enable the Google Calendar API to use it in your application


The the OAuth 2.0 flow both for authentication and for obtaining authorization is similar to the one for Web Server Applications except three points:

1) When creating a client ID, you specify that your application is an Installed application. This results in a different value for the redirect_uri parameter.
2) The client ID and client secret obtained from the API Console are embedded in the source code of your application. In this context, the client secret is obviously not treated as a secret.
3) The authorization code can be returned to your application in the title bar of the browser or in the query string of an HTTP request to the local host.

Please refer to Google OAuth 2.0 documentation for more information.

After you generate this JSON file, start the "oauth2callback.aspx" page for authorization. 

1. Enter the email address you used to generate the JSON file.
2. Select the JSON file on the client machine by clicking the "Browse" button.
3. Click the "Get 'Client ID' and 'Client secret' from file" button to upload the selected file and enable the Google Calendar API.
4. The application should be navigated to the "Default.aspx" page.
5. Select a corresponding calendar to synchronize with the scheduler storage.

P.S. To run this example's solution, include the corresponding "Google Calendar API" assemblies into the project.

For this, open the "Package Manager Console" (Tools - NuGet Package Manager) and execute the following command:

Install-Package Google.Apis.Calendar.v3



The synchronization procedure implemented in this example has the following limitations: 

-     Recurring appointments are excluded
-     Statuses, labels, reminders, and resource associations are not synchronized.

How to use hyperlinks in GridControl cells

$
0
0

This example demonstrates how to show hyperlinks in a grid. To accomplish this task, it is necessary to create a new DataTemplate with HyperlinkEdit and assign it to the GridColumn.CellTemplate property.

Question Comments

Added By: Pritesh P at: 3/11/2014 3:46:07 AM    

hi.
Still i want one more functionality if possible.
I want that "can TextBlock behave same as like Hyperlink in HTML".

Right now it will treat as text.
And i want that can TextBlock support <span> tag & span tag's properties.

How to bind TokenBox to a large data source

$
0
0

This example demonstrates how to bind the TokenBox extension to a large data source on the client side.
Create the GetFilteredData method that should return a list of items based on a string filter parameter. Then, handle the client-side MVCxClientTokentBox KeyUp event and execute the GetFilteredData method using jQuery ajax.

Create the setData method on the client side. After that, remove items that were added earlier and add new items to the TokenBox item collection in the setData method. Note that for certain purposes, it is possible to disable adding custom tokens using the AllowCustomTokens property. 

To reduce the server overload by avoiding unnecessary requests, it is recommended to add the ASPxClientComboBox.BeginUpdate and ASPxClientComboBox.EndUpdate methods. Then, set them at the beginning and end of the setData method.

Finally, add a condition to check if the input value length is more than the minFilterLength variable and add timeout to allow a user to input the entire text and then show obtained items. Handle the client-side ASPxClientTokenBox.TokensChanged event and remove all items from the drop-down window.
Note: item highlighting will not work.

See also:
How to bind ASPxTokenBox to a large data source

How to bind ASPxTokenBox to a large data source

$
0
0

This example demonstrates how to bind ASPxTokenBox to a large data source using WebMethods on the client side.
Create the GetFilteredData method that should return a list of items based on a string filter parameter. Then, handle the client-side ASPxClientTokentBox KeyUp event and execute the GetFilteredData method.
Create the setData method on the client side. After that, remove items that were added earlier and add new items to the TokenBox item collection in the setData method. Note that for certain purposes, it is possible to disable adding custom tokens using the AllowCustomTokens property.
To reduce the server overload by avoiding unnecessary requests, it is recommended to add the ASPxClientComboBox.BeginUpdate and ASPxClientComboBox.EndUpdate methods. Then, set them at the beginning and end of the keyUp event handler.
Finally, add a condition to check if the input value length is more than the minFilterLength variable and add timeout to allow a user to input the entire text and then show obtained items. Handle the client-side ASPxClientTokenBox.TokensChanged event and remove all items from the drop-down window.
Note: item highlighting will not work.

See also:
How to bind TokenBox to a large data source

Chart3D - Getting Started - Lesson 3 - Step 1

GridView - How to copy selected rows from one grid to another one in batch edit mode

$
0
0

This example demonstrate how to copy selected rows data from one grid to another one in batch edit mode with the possibility to remove the copied data without a request to the sever.

The copy functionality is implemented using the ASPxClientGridView.GetSelectedFieldValues method and various methods of the ASPxClientGridView.batchEditApi object. Refer to the following code snippet with the main function that copies row values:

[JavaScript]
ConfirmPredefinedOrders: function(){var handler = function(values){if(values === undefined && values === null)return;var length = values.length;for(var i = 0; i < length; i++){var newIndex = OrderListHelper.AddNewIndex(); GridViewOrderList.AddNewRow(); GridViewOrderList.batchEditApi.EndEdit(); GridViewOrderList.batchEditApi.SetCellValue(newIndex, "ItemName", values[i][0]); GridViewOrderList.batchEditApi.SetCellValue(newIndex, "ItemDescription", values[i][1]);} CatalogPopup.Hide(); OrderListHelper.ClearPredefinedItemsSelection();}; PredefinedItemsGrid.GetSelectedFieldValues("ItemName;ItemDescription", handler);},

 

Also note that in order to implement this scenario, you will need to create a custom template for most command elements on the page. The sample implementation is demonstrated in this example.

See also:
How to move selected rows from the ASPxGridView into another ASPxGridView

How to create protected ranges in a document depending on service bookmarks

$
0
0

The approach for creating protected document ranges in code was demonstrated in the following example:
Protection - How to programmatically create a protected document and apply range permissions 

In this example, we extended this approach by calculating the "protected" and "non-protected" document ranges automatically.
For all paragraphs that started with the "Protected Range" text, we generated corresponding bookmarks and created protected document ranges.
For better visualization, the "protected" ranges are highlighted using the RichEditControl Custom Draw API.


How to pass complex objects to a callback Action as callback arguments

$
0
0

This sample demonstrates how to convert custom types to the JSON string on the client side and parse this string on the server. The conversion is performed using $.toJSON. This function declared in the jquery.json-2.2.min file.
The JSON string is converted in a Controller's Action using the JavaScriptSerializer.Deserialize method.

In the sample, if it is not possible to deserialize user input, an exception is thrown.

See also:
How to pass a complex object as a callback argument

Question Comments

Added By: Włodzimierz Oleksiw at: 9/20/2016 1:49:23 PM    Is it possible to get json model like Action method parameter ?
Here is what I try to do

Added By: Vova (DevExpress Support) at: 9/20/2016 11:29:51 PM    

Hello,

We will process your request in the mentioned ticket. This ticket is in our processing queue now.

Regards,
Vova

How to move selected rows from the ASPxGridView into another ASPxGridView

How to customize columns and rows headings

$
0
0

This example demonstrates how to customize the visual representation of rows and column headings, including changing default captions for columns. To accomplish this task, the HorizontalHeaderItem and VerticalHeaderItem control templates were overridden. 

How to replace standard DXRichEdit command with your own custom command

$
0
0
This example illustrates the technique used to modify the functionality of existing XtraRichEdit commands.
The RichEditControl exposes the IRichEditCommandFactoryService interface that enables you to substitute default command with your own custom command.
First, create a command class, inherited from the command that you've decided to replace. Override its methods. The main functionality and command specifics is located in the Execute or the ExecuteCore method (the latter does not check for the command availability).
Then, create a class implementing the IRichEditCommandFactoryService. You should override the CreateCommand method to create an instance of a custom command class if an identifier of a certain command is passed as a parameter. So, instead of the default command, a custom command will be used by the RichEditControl.
Finally we use this class to substitute the default RichEditControl's service.

How to create a ButtonEdit descendant that can show a multi-line text like MemoEdit

$
0
0

This example shows how to create and use a ButtonEdit descendant that will support multi-line text like MemoEdit.


This descendant's repository items have three additional properties:

RepositoryItemMultiLineButtonEdit.AcceptsReturn - gets or sets a value specifying whether return characters can be inserted into text.
RepositoryItemMultiLineButtonEdit.AcceptsTab - gets or sets a value specifying whether a user can insert tab characters into text.
RepositoryItemMultiLineButtonEdit.ScrollBars - gets or sets a value indicating which scrollbars are displayed.

See also:
Custom Editors.

How to create a ButtonEdit descendant that can show a multi-line text like MemoEdit

Question Comments

Added By: Vernon Robinson at: 8/21/2015 4:12:08 AM    

I am trying to follow this example.  However, in my application, after I add the MultiLineButtonEdit Code and Bitmap to my project, the following happens:

1. The ellipsis do not show on the control in the designer like the example does.
2. The graphic does not show in the RepositoryItem toolbox dropdown when selecting the columnedit.

Other than those two cosmetic issues, the button does function.  Any idea on what I can do to fix these two minor issues?

Added By: Vernon Robinson at: 8/21/2015 4:13:03 AM    

When leaving a comment, How can I attach a document to illustrate a point?

Added By: Uriah (DevExpress Support) at: 8/21/2015 5:36:55 AM    

Hello Vernon,

To process your recent post more efficiently, I created a separate ticket on your behalf: T280958: E5150 - How to fix two minor design-time issues. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Nadezhda Voronina at: 12/27/2016 9:40:46 AM    Thank you very much for this example.
But I have one problem. This control does not display multiline text if it is generated by CustomDisplayText event handler rather than by direct setting the Text property. How can I fix this shortcoming? Or, as a workaround, is it possible to change only the Text property leaving the EditValue unchanged?
Viewing all 7205 articles
Browse latest View live


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