This example demonstrates how to use attributes to set rules for business classes and their properties. The RuleCriteria and RuleRequiredField rules are demonstrated. To learn more about validation and its rules, refer to the Contextual Validation Concepts topic in XAF documentation.
How to Set Validation Rules in Code
How to print the ASPxScheduler using a Report Preview
This example illustrates how to make a printout of the ASPxSchedulerControl. The application creates the XtraSchedulerReport class descendant which uses Scheduler data, the ASPxDocumentViewer control in a popup window displays and prints the report.
For more information please review the document How to: Print the ASPxScheduler Using a Report Preview (Step-by-Step Guide) .
How to implement range selection via a separate ChartControl
This example illustrates how to implement an alternative zooming method using a separate ChartControl to adjust the visible axis range. Two ConstantLine objects are used to indicate the adjustable range area. The ChartControl.CustomPaint event is also used to emphasize the range area.
Example Comments
Added By: Wolfgang Schmidt 6 at: 12/18/2013 2:20:43 AM
Tried example with 13.2.5 -> does not work .hitInfo.InConstantLine is always false, wherever a click is made.
Added By: Alex (DevExpress Support) at: 12/18/2013 9:35:24 AMHi Wolfgang,
To resolve this issue, set the "chartSelectRange" -> RuntimeHitTesting property to True. I will update the example accordingly. Thank you for noticing this.
How to get the error message by using the GetCallbackErrorMessage static method
In this example, the error message is displayed within the redirected page after the error occurs on callback.
The redirection page is specified within the devExpress/errors section of the web.config file by using the callbackErrorRedirectUrl key. The error message is obtained by using the ASPxWebControl.GetCallbackErrorMessage static method. To provide the message redirection between the pages, the ASPxHttpHandlerModule should be registered within the web.config file (for more information, see the How to manually register a HttpHandler Module article).
How to use an image from application resources in a DXPrinting template
When using an image from resources inside a DXPrinting template, your first move might be to write something like this:
<DataTemplate x:Key="reportFooter">
<dxe:ImageEdit IsPrintingMode="True" Source="/E3916;component/Images/logo.png" />
</DataTemplate>
Unfortunately, due to the specific behavior of the Image / BitmapImage controls in Silverlight, this approach might not work. The image is created asynchronously. So, when the DXPrinting engine composes the document, the image is not ready and it is not displayed. The next time you build the document, the image is in the image cache already and is available immediately, so the DXPrinting engine successfully adds it on a document page.
This sample illustrates how to display an image from resources using the ImageDataConverter.
How to export cell range to a DataTable
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 use Criteria Property Editors
This example illustrates the specifics of using Criteria Property Editors in an XAF application. The complete description is available in the How to: Use Criteria Property Editors help topic.
See Also:
How to dynamic change the ObjectType Criteria Property Editors
How to: Disable Property Editors Based on a Business Rule
This example demonstrates how to hide and disable property editors via the Conditional Appearance module. The complete description is available in the How to: Disable Property Editors Based on a Business Rule help topic.
How to use jQuery to drag and drop items from one ASPxGridView to another
The example demonstrates how to use jQuery framework to drag an item from one grid to another.
- Use jQuery UI Draggable and Droppable plug-ins;
- Define "draggable" items in a source grid and "droppable" ones in a destination grid;
- Use the invisible ASPxGlobalEvents control and handle its client-side ControlsInitialized/EndCallback events;
- Initialize the defined draggable/droppable items via the corresponding jQuery selectors;
- Handle the "drop" event of the "droppable" items and perform the client-side ASPxClientGridView API to perform the data editing functionality.
Select the "CartScript.js" source file and review the comments to find illustration of the above steps.
See Also:
E4582: How to reorder ASPxGridView rows using buttons or drag-and-drop
Example Comments
Added By: Marc Michaels at: 1/16/2013 9:03:17 AM
Where is DX.ashx? I can't find any mention of it anywhere.
Added By: Marc Michaels at: 1/16/2013 9:14:32 AM<div class="draggable"> ??? Can't find this anywhere in the example as well. This example really leaves me in the dark there is no explanation of anything. Sadly it's the closest thing I can find to help me drag from one grid and drop on another. Just going to have to struggle through it.
Added By: Marc Michaels at: 1/16/2013 9:21:13 AMRunning example simply results in "The resource cannot be found".
ASPxHtmlEditor - How to implement cascade ToolbarComboBoxes bound to data sources
This example demonstrates how to implement cascading ToolbarComboBoxes on the ASPxHtmlEditor toolbox.
To provide this functionality, the ASPxHtmlEditor was placed into the ASPxCallbackPanel.
The selected value of the main combo box is transmitted as a parameter in a callback to the ASPxCallbackPanel. Then this value is used as a select parameter for the data source of the second combo box.
How to create a document sections based on the values, entered by an end-user
This example illustrates how to generate a document according to the end-user input. To pass specific values to the document's detail section, you just need to assign these values to the e.Data parameter of the SimpleLink.CreateDetail Event. As for the report (page) header (footer) sections, it is necessary to override their DataContext, which is accessible via the corresponding Link properties. For instance, use the LinkBase.PageHeaderDataContext Property to set the data context of a PageHeader.
NOTE: We have a suggestion to enable printing in marginal sections of a document: Links - Provide the capability to define a print template for the TopMargin and BottomMargin areas of a page
WinForms SpreadsheetControl API - Part 2
This example is the second part of the SpreadsheetControl API set of examples that demonstrates how to use the SpreadsheetControl API to programmatically manage spreadsheet documents, without the need for Microsoft Excel to be installed.
This sample introduces API properties and methods used to perform the following operations:
- Insert, delete and modify pictures
- Add a hyperlink to a picture
- Add custom functions to the spreadsheet
Starting from v2013 vol.2:
- Create a table
- Apply a custom style to the table
How to use ASPxHtmlEditor to edit RTF data
It is possible to use ASPxHtmlEditor WYSIWYG capabilities to edit rich text, for example, imported from the RTF file.
This example illustrates how to:
- Store real RTF content in a data source;
- Edit this RTF content within ASPxHtmlEditor.
The StandaloneEditor page:
When a page is loaded for the first time, ASPxHtmlEditor imports either RTF content saved in the Session state or a real RTF document located on a web server via the ASPxHtmlEditor.Import method.
An end-user is able to click the custom ASPxHtmlEditor toolbar item to save the changes. To retrieve the modified rich content from the HTML Editor the ASPxHtmlEditor.Export method is used.
The GridEditor page:
- ASPxHtmlEditor is placed into a column’s EditItemTemplate;
- The ASPxHtmlEditor content is populated by handling the ASPxHtmlEditor.Init event: A real column’s RTF data is imported via the ASPxHtmlEditor.Import method.
- When an end-user clicks the Update button, the ASPxGridView.RowUpdating event is raised;
- A reference to the ASPxHtmlEditor is retrieved via the ASPxGridView.FindEditRowCellTemplateControl method;
- A modified RTF content is retrieved from the ASPxHtmlEditor.Html via the ASPxHtmlEditor.Export method and passed back to the datasource.
- Clicking the “More Info” link invokes ASPxPopupControl, which populates its content via its built-in callback functionality. The popup loads the clicked row’s RTF content transformed to the HTML via our cross-platform RichEditDocumentServer engine.
Please note that this example can't run on the Web because it requires file creation during its running, but the file creation is prevented on our example server.
How to update the Print Preview according to the changes made in DXGrid
This sample demonstrates how you can create a report document from a DXGrid, and update its Print Preview on the same form, by clicking a button.
How to use the ASPxWebControl.CallbackError event to handle application-level errors occurred during callback processing
Normally, you use the Application_Error event handler, implemented in a Web Application project's Global.asax file, to handle all application-level errors. Prior to v2010.2, errors occurred on callback events of DevExpress ASP.NET controls were not handled via the Application_Error event handler. Now, you can assign Application_Error as an event handler of the ASPxWebControl.CallbackError static event, to handle exceptions thrown in callbacks. To accomplish this, add the following code to your Global.asax file:
[C#]voidApplication_Start(objectsender,EventArgse){// Assign Application_Error as a callback error handlerASPxWebControl.CallbackError+=newEventHandler(Application_Error);}
To get exception details and log them, use the following code within the Application_Error event handler:
[C#]voidApplication_Error(objectsender,EventArgse){// ...// Use HttpContext.Current to get a Web request processing helperHttpServerUtilityserver=HttpContext.Current.Server;Exceptionexception=server.GetLastError();// Log an exceptionAddToLog(exception.Message,exception.StackTrace);}
Example Comments
Added By: okan sarıca at: 7/13/2012 5:21:38 AM
i handle the exception in global asax but how can i send message to callbackcontrol for example ? if i throw a new exception in global asax e.message in callbackError function is 'some error occured'
How to bind a Choropleth Map dashboard item to data in code
The following example demonstrates how to bind a Choropleth Map dashboard item to data in code.
How use the Document Map to provide client-side navigation for a web report
This example illustrates the capability to provide client-side navigation for a web report.
If a report has bookmarks assigned to its elements, the Document Viewer automatically displays a Document Map that reflects the hierarchy of report bookmarks on the webpage.
How to use XtraReports in an ASP.NET MVC application
This sample demonstrates a simple ASP.NET MVC application that contains a static report and shows its print preview on the Web page.
Example Comments
Added By: Gabriele Dolfini at: 10/14/2013 4:44:19 AM
An example with data?
How to: Disable Property Editors Based on a Business Rule
This example demonstrates how to hide and disable property editors via the Conditional Appearance module. The complete description is available in the How to: Disable Property Editors Based on a Business Rule help topic.
How to implement custom paging for a web report
This example demonstrates how the ASPxPager control can be used to perform pagination for the ReportViewer control, displaying a multi-page report. At present, ASPxPager does not expose a client-side model (see ASPxPager - publish ClientSide Events and client side API). Also, unfortunately, it's impossible to change a page number in the ReportViewer via server code. You can only do this on the client side: ASPxClientReportViewer.GotoPage. Due to these two peculiarities, it is necessary to perform at least two round-trips to the server (first when selecting a page in the ASPxPager, and second, when calling the ASPxClientReportViewer.GotoPage() method).