Category Archives: Developer Express

Using Bootstrap with the DevExpress ASP.NET Data Grid

DX + Bootstrap
I’ve been having a lot of fun lately (and been quite productive) using Bootstrap as a way to lay my sites out before giving them a final visual style. The past three websites I’ve done have used Bootstrap and I love the CSS classes it provides and the speed with which I can develop a nice, consistent, responsive site with it.

In my most recent project I’ve been working on integrating some of the MVC Extensions from DevExpress with good success. However, one quirk had me scratching my head. My customer was generally very happy with the ASP.NET Data Grid but wanted a few additional features, one being the ability for the user to specify the page size for the grid. Easy enough – I thought – it’s just a setting after all.

However, this is what I saw after enabling the setting:

Page Size Item Before

After some poking around using the Developer Tools in Chrome, I was able to identify the CSS in Bootstrap that was interfering with the rendering of the ASP.NET Data Grid. Here is the CSS I used to fix the issue:

/* for playing happy with DX */
td.dxpDropDownButton img {
    max-width: none;

td.dxpComboBox input {
    margin-bottom: 0px;
    padding: 0px 0px;

With that bit of CSS in place the control now renders properly:

Page Size Item After

Note that there’s also a post available from DevExpress here on fixes for common CSS issues with Bootstrap. However, using that method requires overwriting your bootstrap.css file.

Improvements to Server Mode Grid in DevExpress VCL 12.2

Version 12.2 of the DevExpress VCL controls brings several improvements to the Server Mode feature of the ExpressQuantumGrid control. Both Advantage Database and PostgreSQL are now supported. There is also now support for in-place editing and banded table views when using Server Mode.

But one of the most welcome improvements, I think, is the new capability to specify custom SQL for the SELECT statement that the Server Mode data source components will use. When I last blogged about ExpressQuantumGrid Server Mode, the most vocal feedback was the need to specify custom SELECT statements. Until now this was only possible using Views within the underlying database. But starting with 12.2, DevExpress has introduced two new entries to the collection of Server Mode components to support using custom queries: TdxServerModeADOQueryDataSource and TdxServerModeDBXQueryDataSource. These are counterparts to the existing data source components that feature a SQL property for specifying the SELECT statement.

To see how easy this is to put into practice, download an open my sample from this blog post. Make sure you’ve also created a database and used the contained SQL scripts to create and populate the LotsaRows table.

Open Unit1 and select the Design tab. Delete the existing TdxServerModeADODataSource and replace it with a TdxServerModeADOQueryDataSource.

Setting up the TdxServerModeADOQueryDataSource component is very similar to setting up its non-query counterpart. For the Connection property select the existing ADOConnection1 component and for the SQLAdapter property, specify MSSQL Adapter. For the new SQL property, click the ellipsis button and enter the following SQL statement:

With the SQL statement specified, click the drop down arrow next to KeyFieldNames and select the ID column. Finally, set Active to True.

That’s it for setting up the TdxServerModeADOQueryDataSource. Now, select the Server Mode table view on the form and bind it to the TdxServerModeADOQueryDataSource using the DataController.DataSource property.

At this point you should see that the project is working again more or less as it did in my previous blog post. A million rows of data show, quickly, within the TcxGrid control, featuring fast grouping and sorting.

To actually see the new feature in practice, add a new TcxCheckBox to the main form, adjusting the grid control and giving it a proper caption.

And handle the Click event of the TcxCheckBox with the following code:

procedure TForm1.Column3CheckBoxClick(Sender: TObject);
  SQL: string;
  //improve performance by disabling gridview updates during data operations
    dxServerModeADOQueryDataSource1.Active := False;

    //build SQL statement based on checkstate
    SQL := 'SELECT * FROM LotsaRows';
    if Column3CheckBox.Checked then
      SQL := SQL + ' WHERE Column3 = 1';

    dxServerModeADOQueryDataSource1.SQL.Text := SQL;
    dxServerModeADOQueryDataSource1.Active := True;

And that’s it! By swapping out the existing TdxServerModeADODataSource for its query-enabled counterpart, we can now specify a custom SQL SELECT statement and still benefit from “blazing fast” population, sorting, and grouping of one million rows of data.

You can download the updated Delphi sample source code here.

Open Source Solution for Migrating from ExpressScheduler to XtraScheduler


Express2XtraScheduler is a .NET solution consisting primarily of two assemblies and a WinForms utility that simplify importing database data from the format stored by the DevExpress VCL ExpressScheduler into a format supported by the WinForms XtraScheduler control.


  • Express2XtraScheduler.Core.dll provides the functionality needed to import data from one format to another given a pair of database settings
  • Express2XtraScheduler.UI.dll provides UI controls for mapping source and destination database settings
  • Express2XtraScheduler.exe uses these assemblies to provide a simple utility for transferring data
  • ExpressSchedulerInterop.dll is a Delphi DLL used to read resource information stored as Delphi variants

Express2XtraScheduler App

The solution also contains two simple applications that allow testing both VCL and WinForms scheduler data: ExpressSchedulerApp and XtraSchedulerApp.


Below are links to blog posts that discuss some of the techniques used by this solution:


The source code for the Express2XtraScheduler solution is available immediately on this public Git repo hosted at Bitbucket.

Getting Started with the DevExpress VCL Wizard Control

Version 12.2 of the DevExpress VCL controls contains the long awaited ExpressWizard control. DevExpress released a WinForms version, their XtraWizard control, over four years ago. They have now delivered a native version of this same control for the Delphi VCL.

Features of the ExpressWizard control mirror those touted by DevExpress for their XtraWizard control:

  • You can design dialogs that conform to either the Wizard 97 or Wizard Aero standard… creating standard based UIs has never been easier.
  • Cutting-edge interfaces are only a few clicks away and developers can be certain that their wizard control will look and feel the same as all other DevExpress controls within their applications.
  • By using DevExpress fade in/fade out effects, developers can easily enhance their wizards during page transition operations.

It’s worth noting that the ExpressWizard control is a new product in the VCL subscription. This means that, when installing 12.2, you should select “Modify and Update” rather than simply “Update”. This will allow you to select ExpressWizard for installation.

DX VCL Setup

To get started with the ExpressWizard control, create a new VCL Forms Application in Delphi. Next, use the File, New, Other menu item to display the New Items dialog. Select Delphi Files on the left. On the right you’ll see a new entry: DevExpress 12.2 Wizard Form.

New Items Template

Select this item and click OK.

Using this Wizard Form template nets you three things:

  1. A new form descended from TdxWizardControlForm. This is necessary to support the Aero glass features of the TdxWizardControl (similar to the TdxRibbonForm).
  2. A TdxWizardControl parented on the new form
  3. A single TdxWizardControlPage added to the wizard control

The TdxWizardControl is also found on the component palette and can be dropped on any form. However, if you want to use the Aero style wizard, you’ll need to change your form’s ancestor. Starting in this manner (versus the template) will also give you an empty wizard control with no pages.

To check out the basic features of the wizard control, I’d like a total of three pages: a Welcome page, an Agreement page, and a Finished page. For the Agreement page, I’d like the Next button disabled until the user checks a checkbox. I’d also like the wizard to use the Aero style rather than the Wizard 97 style.

Pages can be added to the wizard control in two ways, both available from the TdxWizardControl and TdxWizardControlPage context menus.

Wizard Context Menu

You can either click New Page directly, or click Page Collection Editor to display a dialog for managing the wizard pages.

Page Collection Editor

Using one of these two methods, add two new pages to the TdxWizardControl. As with the rest of the DevExpress VCL controls, the designtime editors and experience are top notch. You can actually click on the Next and Back buttons at designtime to switch through the wizard pages.

Use the Next and Back buttons to select each wizard page. Then, adjust the Header.Title property so that the pages read Welcome, Agreement, and Finish. You can also adjust the Header.Description property, but this line of text will not be visible when using the Aero style wizard.

Next, add a TcxCheckBox to the Agreement page in the wizard and adjust its Caption property to indicate accepting the agreement.

Added Checkbox

In order to show the wizard we’ll need some code on our main form. Open up Unit1 and click the Design tab. Add a TcxButton to the form. While we’re here, let’s take a very quick look at a new feature of the TcxButton in 12.2. Set the Kind to cxbkCommandLink. Assign values to both the Caption and CommandLinkHint properties. Bump the Font.Size property up to 12 and resize the control to fit its contents. Finally, assign a OnClick event handler with the following code:

uses Unit2;

{$R *.dfm}

procedure TForm1.cxButton1Click(Sender: TObject);
  Form2 := TForm2.Create(Self);

Click Run (or press F9) to check out the new button style.

TcxButton Runtime

Pretty nice huh?

Click the TcxButton to show the wizard dialog. You’ll see that, with no code, you can click Back and Next to navigate through the pages. In addition, the Back button automatically disables when you are on the first page. Also, the Next button caption automatically changes to Finish when you are on the last page of the wizard. However, clicking Finish and Cancel do not currently do anything. In addition, we need some code for our “agreement” and the wizard is still not the Aero style.

Close the app and return to Unit2. Select the TdxWizardControl and set the ViewStyle property to wcvsAero in the Object Inspector. Handle the OnCreate event of the TdxWizardForm itself with the following code to initialize the wizard:

procedure TForm2.FormCreate(Sender: TObject);
  dxWizardControl1.ActivePageIndex := 0;

Next, handle the OnClick event of the TcxCheckBox with the following code:

procedure TForm2.cxCheckBox1Click(Sender: TObject);
  dxWizardControl1.Buttons.Next.Enabled := cxCheckBox1.Checked;

Select the TdxWizardControl and handle its OnPageChanged event with the same logic:

procedure TForm2.dxWizardControl1PageChanged(Sender: TObject);
  dxWizardControl1.Buttons.Next.Enabled := (dxWizardControl1.ActivePageIndex <> 1) or cxCheckBox1.Checked;

Finally, handle the TdxWizardControl’s OnButtonClick event with the following code:

procedure TForm2.dxWizardControl1ButtonClick(Sender: TObject; AKind: TdxWizardControlButtonKind; var AHandled: Boolean);
  if AKind = wcbkCancel then
    ModalResult := mrCancel
  else if AKind = wcbkFinish then
    ModalResult := mrOk;

If you run the application again you’ll see the wizard is now functional. It starts on the Welcome page, and the Next button is disabled for the Agreement page unless the checkbox is checked. Finally, clicking Cancel or Finish dismisses the dialog.

Wizard Animated

Also, notice that each screen of the wizard fades in and out smoothly. Very nice!

You can download the Delphi source code for this example here.

Releasing the Source of a Simple Application Framework

A few years ago I blogged about, and made available on a smaller scale, a simple application framework built using RemObjects Hydra and the DevExpress WinForms controls called tide. I’ve taken some time to clean up the source code and the licensing, as well as getting the project working using the latest RemObjects and DevExpress releases.

The result is now available on Bitbucket. The source code includes a sample based on the Northwind database and the Wiki includes links to several articles on creating the Northwind sample.

Displaying the XtraScheduler Context Menu Programmatically

The XtraScheduler product from DevExpress is suite of flexible and powerful calendar controls. The scheduler control itself has a built in popup menu that displays context sensitive items when the end-user right-clicks the control.

However, it’s not immediately obvious how to display this menu, with the appropriate context options, programmatically. For instance, you may have an XtraGrid control setup synchronized with the XtraScheduler control. It would be pretty sweet if right-clicking an appointment in the XtraGrid control displayed the appropriate XtraScheduler context menu.

With some digging through the XtraScheduler classes, comments, and some trial and error, I was able to come up with the following working code:

        private void gridControl1_MouseUp(object sender, MouseEventArgs e)
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
                SchedulerHitInfo hitInfo = new SchedulerHitInfo(SelectableIntervalViewInfo.Empty, SchedulerHitTest.AppointmentContent);
                WinFormsSchedulerMenuBuilderUIFactory uiFactory = new WinFormsSchedulerMenuBuilderUIFactory();
                SchedulerDefaultPopupMenuWinBuilder builder = new SchedulerDefaultPopupMenuWinBuilder(uiFactory, schedulerControl, hitInfo);
                IDXPopupMenu<SchedulerMenuItemId> popupMenu = builder.CreatePopupMenu();
                ((IDXDropDownControl)popupMenu).Show(schedulerControl.MenuManager, (Control)sender, new System.Drawing.Point(e.X, e.Y));

The first line creates a new instance SchedulerHitInfo with SchedulerHitTest.AppointmentContent specified as the element under the hit info. This controls which menu contents will be displayed. In this case, the menu contents shown when right-clicking an appointment are displayed.

The next three lines create the popup menu itself by using a WinFormsSchedulerMenuBuilderUIFactory and WinFormsSchedulerMenuBuilderUIFactory.

Finally, the last line displays the popup menu itself. The first parameter is an IDXMenuManager, which can be accessed via the MenuManager property of the scheduler control. The second parameter is the parent control for the popup menu. The final parameter is the position for the popup menu within the parent control.

Together, these lines allow you to display the XtraScheduler menu, with the appropriate context sensitive contents and at any position, from code. Hopefully this bit of code comes in handy as these classes aren’t currently (well) documented. Enjoy!

Releasing the Source of VCL Controls based on DevExpress Look & Feel

The “cx-tras” package is a set of components I created nearly ten years ago and have been maintaining since. It is a set of visual components for Delphi that support DevExpress’s Look & Feel technology. This means that they automatically adjust their look based on the appearance and skin settings used in DevExpress VCL applications. The components were originally distributed by myself on request, then by DevExpress Support for a time, and now I’m giving them a home where anyone can access the source.

Various configurations for the Office Gizmo control

Demonstration of the Text Flow Panel control

Examples of the Close Button, Expand Button, and Size Grip

You can now access the source for the cx-tras package on Bitbucket here.

Creating Windows 8 Apps with the DXTREME Preview

A couple of weeks ago DevExpress released a preview of their new “multi-channel” solution: DXTREME. In their own words, “multi-channel means building applications that span devices and optimize the best parts of each platform”. If you haven’t already, I highly recommend taking a look at the information they’ve made available on their website. DXTREME is a great solution for creating HTML5 based applications for the web, iOS, Android, Windows Phone 8 and Windows 8.

While the current preview ships with support for creating apps for iOS, Android, and Windows 8, the tooling in Visual Studio does not currently support creating new DXTREME Windows 8 applications. Luckily the DXTREME preview does ship with the comprehensive DXTravel demo, which I was able to analyze in order to determine how to get started with a DXTREME Windows 8 application.

This blog post is going to be based on the MyTrips application created in the Getting Started section of the Learning Center. You can either take a moment to go through the Getting Started tutorial, or you can download the completed MyTrips app (prior to adding Windows 8 support) here.

With the MyTripsApp solution open, add a new project to the solution. In the Add New Project dialog, select Other Languages>JavaScript>Windows Store>Blank App.

For the project name, enter MyTripsWin8App, and click OK.

Add the following folders to the new Windows 8 project, mirroring the DXTREME project structure: data, layouts\NavBar, and views.

Open both the default.html file in the Windows 8 project and the App.html file found in the DXTREME project. Copy the JS, CSS, and HTML references found below the Framework, Layouts, and Views comments and paste them into default.html under the existing code in the head section.

The references found below the Framework comment are the CSS and JS files required to make the DXTREME magic happen. These include both jQuery and KnockoutJS as well as the DXTREME JavaScript and CSS. Also included in this section is db.js, which houses the DXTREME model, and App.css and App.js, which can both be discarded (as they are specific to the original DXTREME project).

    <!-- DXTREME Framework references -->
    <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="js/knockout-2.1.0.js"></script>
    <script type="text/javascript" src="js/globalize.js"></script>

    <script type="text/javascript" src="js/dxtreme.core-12.2.0.js"></script>
    <script type="text/javascript" src="js/dxtreme.framework-12.2.0.js"></script>
    <script type="text/javascript" src="js/dxtreme.widgets-12.2.0.js"></script>
    <script type="text/javascript" src="js/dxtreme.viz-12.2.0.js"></script>

    <link rel="stylesheet" type="text/css" href="css/dxtreme-12.2.0.css" />

    <!-- DXTREME Model references -->
    <script type="text/javascript" src="data\Db.js"></script>

The references found below the Layouts comment refer to the CSS and JS files that make up the various layouts used in the DXTREME application:

    <!-- DXTREME Layout references -->
    <link rel="stylesheet" type="text/css" href="layouts/Navbar/NavbarLayout.css" />
    <link rel="dx-template" type="text/html" href="layouts/Navbar/NavbarLayout.html"/>
    <script type="text/javascript" src="layouts/Navbar/NavbarLayout.js"></script>

These layouts are named (using the data-name attribute) and can then be employed in the DXTREME application in one of three ways:

  1. A layout with the name “default” will automatically be used
  2. An application-wide layout can be specified using the defaultLayout property on the HtmlApplication app object (instantiated in App.js or default.js)
  3. Each view can specify a layout (in the view’s corresponding HTML file) using the data-layout attribute

The references found below the Views comment refer to the CSS, JS, and HTML that make up each view in the DXTREME application.

    <!-- Views -->
    <script type="text/javascript" src="views/Index.js"></script>
    <link rel="dx-template" type="text/html" href="views/Index.html"/>
    <link rel="stylesheet" type="text/css" href="views/Index.css"/>

    <link rel="dx-template" type="text/html" href="views/About.html"/>
    <script type="text/javascript" src="views/TripEvents.js"></script>
    <link rel="dx-template" type="text/html" href="views/TripEvents.html"/>

Now, with the references added to default.html, add the DXTREME JS and CSS files to the Windows 8 project. To do this, right-click the css folder in the MyTripsApp project and click Open Folder in File Explorer. Drag the CSS files to the css folder in the MyTripsWin8App project. Follow the same steps for the js folder and its contents.

Next, add the MyTripsApp views (HTML, JS, and CSS) and model (JS) as links in the MyTripsWin8App project. Right-click the data folder in the Windows 8 project and click Add>Add Existing Item. Browse to the data folder in the MyTripsApp project and select db.js. Click the drop-down arrow on the Add button and click Add As Link.

Repeat these steps for the contents of the views folder and the layouts\Navbar folder.

In order for the images used in the app to show properly, add flight.png and marker.png found in the MyTripsApp/images folder to the MyTripsWin8App/images folder.

Now open up the default.js file in the Windows 8 project. At the top of the file, add the following code:


The MyTripsApp above should match whatever DXTREME project you are adding Windows 8 support to. Next, add the following code under the call to app.start():

    // added to support DXTREME
    function startDevExpressApp() {

        var app = = new DevExpress.framework.html.HtmlApplication({
            ns: MyTripsApp,
            viewPortNode: document.body,
            themeClasses: "dx-theme-win8phone",

            // below copied from App.js in DXTREME project
            defaultLayout: "navbar",
            navigation: [
                new DevExpress.framework.Command({
                    title: "Home",
                    uri: "Index",
                    icon: "home",
                    location: "navigation"
                new DevExpress.framework.Command({
                    title: "About",
                    uri: "About",
                    icon: "about",
                    location: "navigation"

        app.router.register(":view/:id", { view: "Index", id: undefined });


Compare this code to the code found in the MyTripsApp App.js file. They are very similar, with minor differences for the Windows 8 JS project. You can find more documentation on the application object here.

With these changes in place, you can now run the Windows 8 project and see the trips listed, with links for the Trips and About screen. Clicking a trip shows the trip’s events with a back button to return to the trips list.

You can download the full sample solution with both mobile and Windows 8 projects here.

Hosting XAF ASP.NET Projects using Azure Web Sites

Azure Web Sites is a new offering from Microsoft under their Windows Azure cloud platform. It’s a scalable solution that allows you to host ASP.NET, PHP, and node.js projects. If your needs are basic, your sites – up to 10 of them – can be hosted for free*. If you need something like a custom domain, you’ll pay a bit more – currently about $8/mo. If you’d like a reserved instance, rather than shared, that will kick it up to around $70/mo. But you can run several of your web sites on that one reserved instance.
*bandwidth and database sold separately see site for details

The awesome thing is that you can start with the free setup, get up to 10 web sites going and, if your needs grow, scale your web sites up by simple dragging sliders in a web portal. It’s all very simple and straightforward and seems to work well.

One of the first things I tried with the free Azure Web Sites preview was hosting an eXpressApp Framework ASP.NET solution and database. While there are a few gotchas that came with publishing my XAF project to Azure Web Sites, most were the sort of issues you’d work through publishing an XAF ASP.NET project to any new server. However, there are some Azure-specific steps needed to work through some of these, which I’ll cover towards the end.

To get started, head to the Windows Azure homepage and sign up for Azure Web Sites. Afterwards, visit the Azure management portal. Note that after signing up for Azure Web Sites you’ll be treated to a nice new HTML5 UI for the Azure management portal (unfortunately the database management portal is still Silverlight).

Once you are in the management portal, click WEB SITES on the left, then click the NEW button at the bottom-left of the portal. Select the CREATE WITH DATABASE option (no I’m not yelling, the site is covered in caps).

You’ll need to give both your web site and database a name, and assign a login name and password for your database.

After the process completes, you’ll be left at the DASHBOARD screen for your new web site. On the right, under quick glance, click Download publish profile. This is the file you’ll use in Visual Studio to publish your XAF ASP.NET project. Next, click View connection strings and note the ADO.NET connection string for your Azure database instance.

As a final step in the Azure portal, scroll down the DASHBOARD page and click the link to your database under linked resources. Click the MANAGE button at the bottom of the portal. This should prompt you to add your current IP address to the firewall rules so that you can access the SQL database. Click YES.

This is necessary if you want to debug your application locally with the database hosted on Azure. Afterwards you can click NO to manage the database (we just needed the firewall rule added).

Next, if you haven’t already, you’ll want to download and install the Windows Azure SDK.

Now we can jump into Visual Studio and start the process of setting up the XAF ASP.NET project for hosting in Azure. First, double-click the WebApplication.cs file in the Web project. Select the Sql Connection and then edit its ConnectionString property, using the ADO.NET connection string from above. Make sure you use your real password as that will not be shown in the portal.

With the new connection string in place, and with the firewall rule added from the steps above, you should now be able to click Start to debug your XAF ASP.NET project, and successfully run against the new Azure database. This step will also create the destination database schema within the database hosted on Azure.

With these changes in place, right-click the Web project and click Publish. Click the Import button on the first screen and import the publishing profile you saved from the Azure portal.

Click Next through the wizard. On the final page you can click Start Preview to preview what will be published. Finally, click Publish.

Aaaand YSOD! Here’s where a bit of troubleshooting comes in. Some of this will be similar to publishing an ASP.NET XAF project to any host. Start by disabling Custom Errors in your web.config and Publish again.

Now you should see that the problem is that the DevExpress ExpressApp assemblies are not on the server.

Multi-select the DevExpress assemblies referenced by your Web project using CTRL or SHIFT. In the Properties Window, set Copy Local to True.

Go ahead and Publish again. Now, all of the DevExpress assemblies referenced by your project will be uploaded to Azure.

Aaaand YSOD! Even after setting all of the assemblies explicitly referenced by the ASP.NET project to Copy Local, there are missing ExpressApp assemblies.

Some assemblies – for instance DevExpress.ExpressApp.Security and DevExpress.ExpressApp.Objects – are not explicitly referenced by any of the XAF projects (mentioned to DevExpress here). While this may be addressed by DevExpress in a future update, in the meantime you’ll need to explicitly add any references with the Add Reference dialog, set Copy Local to true, Publish, and repeat on YSOD.

At this point, the ASP.NET XAF app should run properly hosted in Azure Web Sites.

But, there’s one last “gotcha” I want to cover, as trouble-shooting this is specific to Azure Web Sites. If you encounter the generic XAF ASP.NET error, you’ll need access to the XAF log to troubleshoot.

This may happen, for instance, if you make use of the HTML property editor in your ASP.NET solution and have not published all of the required assemblies.

To access the XAF log, go back to the Azure management portal. Click on the link under FTP HOSTNAME, which is in the quick glance column of the DASHBOARD.

You’ll be prompted for a username and password. You can get these by editing the PublishSettings file (downloaded above) in Notepad. Look for the userName and userPWD values after the FTP publishMode.

Once you’ve logged in, you’ll have full FTP access to both your sites and any logs. Navigate to site, then wwwroot. You should see an eXpressAppFramework.log file.

View the file’s contents, and search for “error occurred”. This will help you find XAF errors that occur that don’t cause a YSOD. This can and will happen for missing assembly references, such as DevExpress.SpellChecker.Core, if you use the HTML property editors.

With connection strings in place and all of the proper assemblies referenced and published, XAF ASP.NET projects run quite well in Azure Web Sites.

I’ve been using Azure Web Sites for a couple of months to host both my personal website and the website for Hip Shot and have been very pleased overall. And, if you don’t need a custom domain or a reserved instance, your web site hosting is free – bandwidth and database storage aside.

Emitting XtraScheduler Reminder XML

In a previous post I discussed how to generate the XML that the DevExpress XtraScheduler uses when persisting its appointment resource ID’s to a database. You can read that blog post here, and review the structure of the XtraScheduler data tables here.

In this post I’ll cover how to create the XML needed to persist XtraScheduler reminder information to a database. It’s pretty straight forward but not covered (yet) in the DevExpress documentation for the XtraScheduler control.

Again you’ll need a reference to the DevExpress.XtraScheduler.XML namespace. The classes you’ll be using are ReminderInfo and ReminderInfoContextElement. Here is an example of how to use ReminderInfo along with ReminderInfoContextElement:

        private string GetReminderInfoXML(DateTime? reminderDate, int? reminderMinutes)
            ReminderInfo reminderInfo = new ReminderInfo();

            if (reminderDate != null)
                reminderInfo.AlertTime = reminderDate.Value;
            else if (reminderMinutes != null)
                reminderInfo.TimeBeforeStart = new TimeSpan(0, reminderMinutes.Value, 0);

            ReminderInfoContextElement element = new ReminderInfoContextElement(reminderInfo, DateSavingType.LocalTime);
            return element.ValueToString();

I’ve also put together a small working example that you can download here.

UPDATE: There’s a real-world example of this technique you can find here. It is an open source project for transferring data from ExpressScheduler to XtraScheduler.