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

How to customize cell appearance in WPF Spreadsheet based on custom logic

$
0
0

Cell template in WPF Spreadsheet allows you to change the visual presentation of cells. To assign a cell template, use the CellTemplate property of the SpreadsheetControl, as illustrated in the How to customize cell appearance in WPF Spreadsheet using a cell template example.
The template is applied to all existing cells in the worksheet. However, you can have more than one template and implement custom logic to choose the desired template. This allows you to provide a different visual appearance for individual cells. To choose templates based on a custom logic:
1) Create a template selector class that derives from the System.Windows.Controls.DataTemplateSelector class and override the SelectTemplate method to return a template which meets the required condition.
2) Assign its instance to the CellTemplateSelector property.

This example uses template selector to display formulas above certain cells. If a cell does not a contain a formula, it displays a red marker that warns about missing formula.
The result is shown below:




How to create a web based report at runtime

$
0
0

This example demonstrates how to create a simple web report at runtime.

How to maintain the visibility of components in the End-User Designer

$
0
0

The following example demonstrates how to maintain the visibility of components (such as DataSet and DataAdapter) in the End-User Report Designer for Windows Forms.

In the End-User Report Designer, you can hide a report's associated components together, or list them in the Report Explorer or the Component Tray displayed at the bottom of the Design Panel.

How to show a text watermark in a web application

$
0
0

Despite the fact that XtraReports doesn't support watermarks for ASP.NET applications, there are ways to avoid this restriction. One of these approaches is illustrated by this example.

To simulate text watermarks, you can create a DIV block and via css classes define its placement on a web page against the block containing the DocumentViewer. The key role here mainly belongs to the z-order property. Also, you can avoid the watermark's text selection by adding the OnSelectStart='return false;' into the watermark's DIV tag (however, this fails to work in Opera, while IE and Mozilla understand this clearly).

Be accurate when positioning the watermark's block, pay special attention to its dimensions. Also, a watermark's overall text appearance can be widely customized via css properties.

ASPxFormLayout - How to save values to DB by using an Eval binding expression

$
0
0

It's possible to update data in DB by using the ASPxFormLayout with an Eval binding expression:

- Set the LayoutItemBase.Name;

- Bind editors in LayoutItems with an Eval binding expression;

- Loop thru the layout items and set the SqlDataSource parameter default valuea depending on the layout items names.

How to enable caching of web reports to allow switching them on the client

$
0
0

The code in this example implements the native caching of web reports displayed by the ASPxDocumentViewer control which allows instantly switching the documents that are cached on the client.

During the ASPxClientComboBox.SelectedIndexChanged event, the HiddenField value is used to identify a report before its initialization that is performed within the Page_Load event handler.

Example Comments

Added By: Chad Eklund at: 6/7/2012 5:15:15 PM    

This does not work, refresh is no a property of ReportViewer

viewer.Refresh();

Added By: Alex (DevExpress Support) at: 9/18/2012 5:06:55 AM    

Hi Chad,
The Refresh method is a part of the ReportViewer client-side API: http://documentation.devexpress.com/#XtraReports/DevExpressXtraReportsWebScriptsASPxClientReportViewer_Refreshtopic.

Added By: Øyvind Hægeland 1 at: 10/8/2012 10:59:25 AM    

I try to use 2 reports activated by a combobox, but get an error on the hf surroundeed by quotation marks.
I have tried single quotation marks ' , but i won't help.

                <dx:ASPxComboBox ID="cboNorskEngelsk" runat="server" ValueType="System.String">
                    <Items>
                        <dx:ListEditItem Text="Norsk" Value="1" />
                        <dx:ListEditItem Text="Engelsk" Value="2" />
                    </Items>
                    <ClientSideEvents SelectedIndexChanged="function(s, e) {
                  document.getElementById("hf").value = s.GetSelectedItem().value;
                        viewer.Refresh();
                    }" />
                </dx:ASPxComboBox>

Regards
Reidar Thorsvik

How to implement the drill-down feature for a web report: extended version

$
0
0

This example is an extended version of the following solution: How to implement the drill-down feature for XtraReports in a web application.

The main improvement in this example is using the ASPxCallbackPanel to host the ASPxDocumentViewer control. As a result, the report content is being updated via the callbacks, with the benefits of avoiding the entire web page being regenerated and maintaining the position of the web browser window scrollbars.

Clicking the nodes in the master report calls the corresponding javascript event handler (a similar technique is described in the following example: How to use the ASPxPopupControl to implement a drill-down report). This initiates the callback to the server via the ASPxClientCallbackPanel.PerformCallback method.

The consequent updating of the report document is performed on the server within the ASPxCallbackPanel.Callback event handler. Once the callback is completed, the resulting report appears on the client.


How to export cell range to a DataTable

$
0
0

This example illustrates how you can export worksheet cell range to a System.Data.DataTable object.

The following steps are required:

1) Add a reference to the DevExpress.Docs.v13.2.dll assembly to your project containing the SpreadsheetControl. Note that the Universal Subscription or an additional Document Server Subscription is required to distribute this assembly.
2) Create the DevExpress.Spreadsheet.Export.DataTableExporter instance using the DevExpress.Spreadsheet.Worksheet.CreateDataTableExporter method.
3) Call the Export method of the DataTableExporter.

You can create an empty DataTable by using the CreateDataTable method of the DataTableExporter. The column names are obtained from headings of the cell range, and the column data types are extracted from cell data types of the first row of a range.
The DataTableExporter contains various options that enables you to specify how cell data are processed before storing them in a DataTable.


How to merge different web reports into one document

$
0
0

This example illustrates how to merge individual reports into a single document that is then displayed on a web page using the ASPxDocumentViewer.

How to implement cascading lookups

$
0
0

This example demonstrates how to implement cascaded lookups. The main idea is to get the changed value of the first lookup and select data based on this value for the second lookup. It is necessary to perform the following steps:

1. Handle the dxLokup.valueChangeAction event of the first lookup;
2. In this event handler pass the selected value of the first lookup to the DataSource.filter method of a data source that is related to the second lookup.

See also:
OData Associations
ODataContext
dxLookup
ODataContext - How to filter data by a foreign key value

How to implement CRUD operations with a DataSource

$
0
0

This example demonstrates how to implement CRUD operations with a DataSource that obtains data from a remote Rest service. The DataSource object does not implement CRUD operations out-of-the-box. We can do this using jQuery.ajax. It is also necessary to call the DataSource.load method to "inform" your widget that it is necessary to reload its content.

See also:
Connect to RESTful Service
How to implement the Rest service based on an ASP.NET WebAPI application

Example Comments

Added By: Leovin S at: 8/20/2013 6:38:42 AM    

Thank you for the code.But the problem is that it is related to data that is retrieved through the service.I tried getting my data retrieved from my json file but then it shows errors.
So ,if you could give me a stand alone project ,including the data base I would be able to understand very clearly.

ASPxGridView - How to hide the EditForm editor and column caption programmatically

How to hide an EditForm editor based on a column value

Client and server validation within ASPxGridView's templates

$
0
0

This example demonstrates how to perform validation of editors placed within ASPxGridView's templates. Here both the integrated validation via ValidationSettings.RegularExpression and a custom validation on Validation events are used.

Another approach used here is the multi-row editing, which means that the grid allows you to instantly edit several row values. Thereby, the grid's edit form is not used in the example at all. (The multi-row editing approach is also described in example E324.)

It's important that validation in this example is performed both on the client and server, since we cannot guarantee that the client sends us valid data. All validation rules are implemented both on the client and server, but the client validation serves only as an input helper. The final word always rests with the server.

The end user inputs some values into text boxes and clicks the Save button. Then, the client validation is performed. In a regular case, if some editors contain invalid values, the end user will be informed about the mistakes he/she made, and a postback won't be sent to the server. However, even if the client validation passes despite that some of the editors contain invalid values, the server will validate all the editors, and only valid editor data will be sent to the database (in this example, a simple List<Record> stored in the Session is used as a data storage).

How to provide the ability to resize rows

$
0
0

Description:
 I am trying to provide my end-users with the ability to change a specific row's height via the mouse. Is there a way to implement this feature?

Solution:
 The XtraGrid doesn’t provide such a feature automatically due to the fact that it doesn't cache any data internally. Thus it can’t store different row sizes. However, you can implement this task yourself. To do this you should handle the GridView's MouseDown, MouseUp and CalcRowHeight events. Within the MouseDown and the MouseUp events you should handle row size changing. Within the CalcRowHeight event handler you should pass the valid row height for a specific row. In the attached project you will find a sample project which demonstrates this task

Example Comments

Added By: Filan Behmen at: 12/11/2013 2:35:19 AM    

There is bug in this code. When you filter the rows and then delte the filter, then visible rows become huge. Please help!


How to make custom axis labels display current system date and time

$
0
0

This example demonstrates how to change a text of custom axis labels at runtime. In particular, it demonstrates how to make them display the current system date and time.

Note that to access the custom labels collection, you should first access its parent axis. That can be done only if you cast your chart's diagram object to the appropriate diagram type.

How to apply a certain layout to the required view

$
0
0

It is necessary to handle the HtmlApplication.resolveLayoutController event and specify the required layout controller that must be used to provide a layout markup for the given view. All predefined layout controllers are contained in the DevExpress.framework.html.layoutControllers collection. The main idea is to find the required controller in this collection and set it to the layoutController parameter in the resolveLayoutController event handler. In addition, please make sure that links to files that are related to the required layout are added to the index.html file.

This example demonstrates how to apply the Empty layout to the About view.

See also:
jQuery.grep

How to mediate a pair of bridged Chart and Pivot Grid with a Filter Control

$
0
0

This example utilizes the DevExpress.ExtraEditors.FilterControl, to filter the data auto-retrieved by a chart from its associated Pivot Grid.

How to place series with different axes side-by-side

$
0
0

This example demonstrates how series with different Y-axes can be placed side-by-side.

In fact, since XtraCharts v2009 vol 1 version this is done automatically for side-by-side Bar, Range Bar and Gantt series. This means that if, for example, the X-Axis is common for multiple series, and the Y-Axis is different, the series are automatically placed side-by-side.

How to provide a custom cursor for a chart

$
0
0

This example demonstrates how to substitute the Hand and Grab cursors shown when a chart's area is being scrolled with a default system cursor.

To do this, handle the QueryCursor event, and use the QueryCursorEventArgs.Cursor and QueryCursorEventArgs.CursorType properties.

Viewing all 7205 articles
Browse latest View live


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