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

How to obtain a dashboard item's underlying data in the ASP.NET Dashboard Control

$
0
0

The following example demonstrates how to get underlying data corresponding to a particular visual element using the ASPxClientDashboard's API.

In this example, the ASPxClientDashboard.ItemClick event is handled to obtain underlying data and invoke the dxPopup widget with the child dxDataGrid. In the event handler, the RequestUnderlyingData method is called to obtain records from the dashboard's data source. The dxDataGrid is used to display these records.


How to Access the Application Model in Code

$
0
0

This example demonstrates how to use the View.Model property to set the required value for the current ListView node's MasterDetailMode property. For this purpose, a new View Controller is created, and a SimpleAction is added to it. This Action allows end-users to switch between two modes: the current List View only and the current List View together with the corresponding Detail View.

See code in the SwitchController.cs (SwitchController.vb) file. For details, refer to the Access the Application Model in Code topic in XAF documentation.

How to obtain a dashboard item's client data in the ASP.NET Dashboard Control

$
0
0

The following example demonstrates how to obtain client data corresponding to a particular visual element using ASPxDashboard's client-side API.

In this example, the ASPxClientDashboard.ItemClick event is handled to obtain client data and invoke the dxPopup widget with the child dxChart.

In the event handler, the ASPxClientDashboardItemClickEventArgs.GetData method is called to obtain dashboard item's client data. The ASPxClientDashboardItemClickEventArgs.GetAxisPoint method returns the axis point corresponding to the clicked card while the ASPxClientDashboardItemData.GetSlice method returns the slice of client data by this axis point.
To obtain axis points belonging to the "Sparkline" data axis, the ASPxClientDashboardItemDataAxis.GetPoints method is used. Corresponding actual/target values are obtained using the ASPxClientDashboardItemData.GetDeltaValue method.

The dxChart is used to display the detailed chart showing a variation of actual/target values over time.

How to show a complex dialog

$
0
0

Task: We need to ask the user for a number of values by presenting a complex dialog with a number of entry fields nicely arranged.

Solution: An arbitrary dialog can be shown using standard XAF concepts. Any XAF form is a window that shows a certain view. To show a dialog, we create a non-persistent class with properties representing entry fields and show a DetailView of its instance via the PopupWindowShowAction. The class we created is included in the application model and has its default generated detail view, which we can customize to achieve the desired layout. Besides querying simple values, we can add a collection-type property to the dialog class to allow selecting items from the list. This selection can be read in the action's Execute event by accessing ListPropertyEditor representing the nested list view. The popup window displayed via the action contains the usual OK and Cancel action buttons provided by the DialogController. If necessary, you can provide additional action buttons by creating a controller for the dialog class with the Category set to PopupActions.

Note, to show collections in an editable detail view on the Web, use this solution.

See also:
Non-Persistent Objects

How to access API of underlying widgets in the ASP.NET Dashboard Control

$
0
0
This example demonstrates how to customize client widgets used to visualize data within dashboard items at runtime using ASPxClientDashboard's API. This approach is described in greater detail in the Access to Underlying Widgets help topic. 
The following options are changed:
- Highlighting of the hovered grid row is enabled in the underlying dxDataGrid in the ItemWidgetCreated event handler.
- A standard tooltip that is invoked when an end-user hovers over a chart series point is disabled. You can invoke a tooltip by clicking the required label on the argument axis. The argumentAxisClick event is used for this purpose. Subscription and unsubscription to/from the argumentAxisClick event are performed in the ItemWidgetUpdated and ItemWidgetUpdating event handlers respectively.
- A pie legend is shown for the underlying dxPieChart.

How to access API of underlying widgets in the ASP.NET MVC Dashboard Extension

$
0
0
This example demonstrates how to customize client widgets used to visualize data within dashboard items at runtime using ASPxClientDashboard's API. This approach is described in greater detail in the Access to Underlying Widgets help topic. 
The following options are changed:
- Highlighting of the hovered grid row is enabled in the underlying dxDataGrid in the ItemWidgetCreated event handler.
- A standard tooltip that is invoked when an end-user hovers over a chart series point is disabled. You can invoke a tooltip by clicking the required label on the argument axis. The argumentAxisClick event is used for this purpose. Subscription and unsubscription to/from the argumentAxisClick event are performed in the ItemWidgetUpdated and ItemWidgetUpdating event handlers respectively.
- A pie legend is shown for the underlying dxPieChart.

How to extend text properties of appointments exported to iCalendar format (to add meeting requests with attendees)

$
0
0

This example demonstrates how you can export e-mail addresses stored in a database to the ics file as required attendees.

The XtraScheduler originally does not support meeting requests with attendees. To accomplish this task, use the CustomFields mechanism to bind e-mail data to scheduler appointments. To control the export process that is performed via the Export method of the iCalendarExporter class, handle its AppointmentExporting event. Within the event handler, you can modify VEvent object's properties and extend it with custom text properties.
To create a new text property - ATTENDEE in this case - create an object of the DevExpress.XtraScheduler.iCalendar.Components.TextProperty type, specify required parameters (CN and RSVP) and add this property to the DevExpress.XtraScheduler.iCalendar.Components.iCalendarPropertyCollection of custom properties. This collection is accessible via the CustomProperties property of the current VEvent object.

The sample project contains an MS Access (mdb) database and a custom AppointmentForm so you can edit custom fields containing e-mail data.

To see the result, open the saved ics file in MS Outlook, double-click the imported appointment and see addresses of the attendees displayed in the Meeting form.

Question Comments

Added By: Gerard D'Rozario at: 3/14/2017 3:54:34 AM    Is there a reason this project requires a version of VS greater than VS 2010 (or .NET 4.5 maybe)>Added By: Oleg (DevExpress Support) at: 3/14/2017 5:44:35 AM    Hello Gerard,
By default, you can download our examples in the latest version of our components. The latest 16.2 version supports only .NET Framework 4.0 (and higher) and VS 2010 (and higher).
Please refer to the following topic:
System Requirements

However, you can select an old version of this example (v2010 vol 2.3 - v2012 vol 2.18) which can be opened in VS 2008 under .NET Framework 2.0. Please see the image below:


I hope you will find this information helpful.

How to get item data using the Client Side scripts and export this data to Excel by generating a custom report

$
0
0

Udpate: The ASPxDashboardViewer version 15.2 supports the Export To Excel functionality out of the box: Exporting Dashboard Items

In this example, you will find how to export item data using the report suite. The export is performed in three steps:
1. We request data displayed in a specific dashboard item using a client-side script provided in the T182186: How to get visible data from a certain dashboard item on the client side and process it on the server side example and send this data to the server in the form of a JSON string. Also information about actual dashboard parameters is requested using the ASPxClientDashboardViewer.GetParameters Method.
2. The JSON string is parsed on the server side. Based on the retrieved data, we generate a report containing a simple table displaying item's data and add information about actual parameter values to the report header. 
3. Finally, it is necessary to export the report to an Excel document and write this document to the response. It is possible to use the same approach to export the resultant report to other file types. 


How to apply Master Filtering in the ASP Dashboard Control in OLAP mode

$
0
0
The following example demonstrates how to apply master filtering in ASPxDashboard on the client side when the dashboard is connected to an OLAP cube.

In this example, the ASPxClientDashboard.SetMasterFilter method is used to select required cards in the Card dashboard item. This method is called in the onClick event handler of the dxButton.

How to handle a double-click on a grid row in a MVVM application

$
0
0

This example demonstrates one of many possible solutions for decoupling DXGrid mouse event handling from business logic, when using the MVVM architectural pattern.

Question Comments

Added By: Gert Hauan at: 1/26/2015 2:08:55 AM    

Hi

I am trying to get this to work, but without success. The reason is possibly the way that MVVM is implemented in the application I am working on. It is different from the way you have done it.

If I understand your code correctly, you have one viewmodel object pr row in the datagrid. In the application I am working on, there is one viewmodel for the whole view, that is the viewmodel is the datacontext of the view. Then the ItemsSource of the datagridcontrol is bound against a collection in the viewmodel.

Basicly what I would like to do is this: Today there is a button under the gridcontrol called "Open". This button is bound to a command in the viewmodel that opens a new (PRISM)view based on the FocusedRow. I need that same command to fire when a row is doubleclicked. Could you help me along the way here?

(It is difficult to post an example project due to the size of the app.)

Added By: Alexander (DevExpress Support) at: 1/26/2015 8:26:33 AM    

Hi Gert,

This is old example. Now, we have the MVVM Framework that allows doing such things with ease. I suggest you use the EventToCommand with an EventArgsConverter in the following manner:

[XAML]
<dxg:GridControlName="gridControl"...><dxmvvm:Interaction.Behaviors><dxmvvm:EventToCommandPassEventArgsToCommand="True"Command="{Binding EditCommand}"EventName="MouseDoubleClick"><dxmvvm:EventToCommand.EventArgsConverter><dx:EventArgsToDataRowConverter/></dxmvvm:EventToCommand.EventArgsConverter></dxmvvm:EventToCommand></dxmvvm:Interaction.Behaviors> ...</dxg:GridControl>

You can see how this code operates in the How to build a fully-functional and well-organized MVVM application in a few clicks with DevExpress components (Visual Studio 2012+) example (file - EmployeeCollectionView.xaml).

Added By: Gert Hauan at: 1/27/2015 12:59:56 AM    

Hi

Do you know if I may use  this functionality from your MVVM Framework in conjunction with the PRISM framework?

(FYI: I was able to get the double-click to work by using this approach: https://www.devexpress.com/Support/Center/Question/Details/Q534762 )

Added By: Alexander (DevExpress Support) at: 1/27/2015 1:30:09 AM    

Our MVVM Framework consists from independent parts that can be used with any other third-party framework. 

Added By: Roland Harrison at: 2/27/2017 2:59:34 AM    Would be good to update these to use the new POCOViewModelAdded By: Andrey K (DevExpress Support) at: 2/27/2017 7:07:03 AM    Thank you for sharing your opinion with us. We appreciate it.

Thanks,
AndreyAdded By: samuele capraro at: 3/14/2017 4:09:02 AM    This works but there is a bug. This works also on the header. if you double click on the header of the column the example crashes.

It is possible to avoid enable double click on the header of the columns?
Added By: Kirill (DevExpress Support) at: 3/14/2017 6:39:57 AM    

Hello,
Thank you for this information. We will update this example and fix this issue.

In general, our TableView class has a special event - the RowDoubleClick event. So, you can use this event rather than the MouseDoubleClick event handled in this sample.


Thanks,
Kirill

How to: Implement a Security System User Based on an Existing Business Class (EF)

$
0
0
A similar example for XPO is E4160.
Question Comments

Added By: Martin Svärd at: 3/13/2017 1:40:53 PM    Hi,
I have used this solution earlier i XPO but cannot get this example to work in EF.
It starts as expected but when you change password it isnt stored so you cannot change password.
The password continues to be blank.
This is the case with the example as well.
Any suggestions?
Added By: Uriah (DevExpress Support) at: 3/14/2017 9:14:26 AM    

Hi Martin,

I've created a separate ticket on your behalf (T492566: Cannot change the password using the solution provided in the T390221 ticket). It has been placed in our processing queue and will be answered shortly.

How to show a custom form as the WinForms Dashboard Designer

$
0
0

Scenario
This example describes how to show a custom form as the WinForms Dashboard Designer used to create and modify dashboards in the WinForms XAF applications. This can be required for the menu customization. For example, add custom BarItems or remove some default BarItems.

Steps to implement
1. Add a new XtraForm or RibbonForm to the project.
2. Add DashboardDesigner to the newly created form as it is described in the Create a Designer Application chapter of the Creating a WinForms Designer and Using It to Create a Dashboard article.
3. Add a property of the DashboardDesigner type to the custom form.
4. In the Windows Forms module, add a Controller that is activated in the IDashboardData Views only.
5. Access the WinShowDashboardDesignerController using the Frame.GetController<ControllerType> method.
6. Access the DashboardDesignerManager object using the WinShowDashboardDesignerController.DashboardDesignerManager property.
7. Handle the DashboardDesignerManager.CreateCustomForm event. Create and assign a custom XtraForm to the CreateCustomFormEventArgs.Form property.

See also
Access the WinForms Dashboard Designer

How to connect different XPO data models to several databases within a single application

$
0
0

Scenario

This example demonstrates how to create custom XAF modules with custom business objects and logic that would work with separate databases. These modules do not depend on each other and thus can be reused in other applications as a whole.
Usually, the connection to the database is set up in the executable application project. Typically, it is performed in the configuration file or directly in the code of the application's designer or within the Main function/Global application class. To learn more, please check out this help topic: Connect an XAF Application to a Database Provider In this example, you will learn how to establish a connection to the database directly from your module projects.


Steps to implement

1. Add two new custom XAF modules into a new XAF solution using the XAF Solution Wizard as  described here;

2. Add required persistent classes into these modules as shown in the ClassLibraryN/PersistentClassN.xx files of this example solution;

3. Add service ModuleInfo classes into these modules as shown in the ClassLibraryN/ModuleInfoN.xx files of this example solution;

4. In YourModuleName/Module.xx files, override the Setup(XafApplication application) methods of the ModuleBase descendants to handle the CreateCustomObjectSpaceProvider event of the XafApplication class as shown in the ClassLibraryX/XafModuleN.xx files of this example solution;

5. Build the solution, invoke the Module Designer for the platform-agnostic module (YourSolutionName.Module/Module.xx), and drag the created custom modules from the Toolbox:

Alternatively, you can add the same modules via the Application Designer invoked for the executable projects (as demonstrated in this example).

6. Declare connection strings in the configuration files of your application as shown in the TwoXpoModelsForDifferentDatabases.Web\Web.config and TwoXpoModelsForDifferentDatabases.Win\App.config files (see ConnectionStringDatabaseX under the <connectionStrings/> element). These connection strings are used in the modules via the ConfigurationManager.ConnectionStrings API, but you can always modify the way your modules obtains this data.

Important notes

1. Each module has a single static XPObjectSpaceProvider instance, which is initialized only once during the application life cycle.
2. Each ModuleUpdater class checks whether it is valid to create initial data of a certain type from this module via the IObjectSpace.CanInstantiate method.
3. Business classes linked to different ObjectSpaceProviders are considered to be isolated from each other and thus cannot have direct links between them, e.g., there is an association between two classes. Consider using the How to prevent altering the legacy database schema when creating an XAF application or alternative solutions if you need interlinks between classes from different data stores.

4. If several XPObjectSpaceProvider objects are connected to the same database, then it would be necessary to additionally map the service XPObjectType class to different tables in each XPDictionary. You can do this in the application_CreateCustomObjectSpaceProvider method by adding DevExpress.Xpo.PersistentAttribute with a modified mapping: 

[C#]
...XPClassInfoci=typeInfoSource1.XPDictionary.GetClassInfo(typeof(XPObjectType));if(ci!=null){ci.RemoveAttribute(typeof(PersistentAttribute));ci.AddAttribute(newPersistentAttribute("Service_XPObjectType1"));}...

5. Domain Components (DC) cannot be used with this approach, because the XpoTypeInfoSource constructor expects a list of entity types as a parameter, which is not known at this moment. You cannot call the RegisterEntity/GenerateEntities methods of the XafTypesInfo class to obtain this list either, because in this case the types will be registered for all XpoTypeInfoSource objects within the application.

6. To manipulate objects, create an object space using the XafApplication.CreateObjectSpace(Type) method passing the Type argument. The database to which the created object space is connected depends on the passed type.



See also:
How to prevent altering the legacy database schema when creating an XAF application

How to modify the availability/visibility of context menu items on the client side

$
0
0

In some scenarios you need to change availability/visibility of some context menu items in depending on selected appointment properties.

Since ASPxScheduler.PopupMenuShowing is a server-side event and is raised only before the PopupMenu is generated during a postback/callback request, the mentioned behavior can't be implemented in this event handler.

This behavior should be implemented in the client-side ASPxClientMenu.PopUp event handler.

This example demonstrates how to achieve it.

How to bind XtraScheduler to data using LINQ to SQL

$
0
0

This example demonstrates how to bind the Scheduler to SQL server using LINQ to SQL data model.
Note that the Scheduler control does not automatically respond to data modifications in the LINQ data source. The reason for this behavior lies in the fact that the scheduler is bound to a copy of data provided by the LINQDataContext. The LINQDataContext does not provide a list change notification mechanism that can be used by a scheduler. So after the initial data binding the scheduler can only trace changes originated from the actions performed by the scheduler itself. Click the Refresh button to reload data and display changes of the underlying data source.

To run the project, you need a database at the local SQL server. The script used to create the XtraCars database is included in the XtraCars.sql file. Create the database and change the connection string in the app.config file, if necessary.

Question Comments

Added By: Bryan Miller at: 9/24/2012 7:20:31 PM    

Followed this example, when I change one of the property in my linq object by code, the change is not updated to the Appoinment and refreshed on the Scheduler control, what else do I need to change . I thought any changes to the underlying datasource will update the Scheduler

Lawlaw


ASPxGridView - How to hide a grid column on the client side without making a round-trip to the server

$
0
0

This example demonstrates how to hide a grid column on the client side without making a round-trip to the server.


To accomplish this task, apply a dummy CSS class ('unitPriceColumn') to all column cells (header, data, edit, footer, group footer, and filter cells) in markup. Then, to show/hide these cells, just specify their 'display' style. Set it to the 'none' value to hide cells and to the 'table-cell' value to show cells. To specify a cell display style, I used a jQuerry CSS selector (using the 'unitPriceColumn' CSS class).

Question Comments

Added By: marc parthoens at: 8/25/2014 4:20:36 AM    

Can you show how I can get the value/text of a hidden column SERVER side.
Thanks

Added By: Mike (DevExpress Support) at: 8/25/2014 4:23:38 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T143607: ASPxGridView - Get Hidden Column Value on Server Side. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Daniel Kaminski at: 11/21/2014 11:04:53 AM    

I am duplicating this code in my project but I am getting this error http://screencast.com/t/NYB5i8prBLsu
Do you have any ideas what I need to do to fix it?

Thanks,
Daniel

Added By: Marion (DevExpress Support) at: 11/23/2014 10:44:37 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T177485: ASPxGridView - How to hide a grid column on the client side without making a round-trip to the server. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Focoenobra Ltda at: 11/25/2014 8:25:04 AM    

Greetings:
I'm working with this example, but with a Grid which contains a GridViewBandColumn,, fixed column and a horizontal scroll. The columns hide correctly, but when I move the scroll, the columns are visible again.
Can you help me with this issue?

Added By: Gosha (DevExpress Support) at: 11/25/2014 12:36:18 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T178629: How to hide a grid column on the client side without making a round-trip to the server. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: David Buitenveld 1 at: 1/31/2015 12:47:34 PM    

Hi, I am trying to implement this strategy in a project and it works as expected. But when I click the New link to add a row (grid goes into inline edit mode), the hidden column reappears. Any idea what I might have missed? I note that the grid's Init and EndCallback functions never seem to get called..

thanks -

David

Added By: Larry (DevExpress Support) at: 2/1/2015 11:09:56 PM    

Hello David,

To process your recent post more efficiently, I created a separate ticket on your behalf: T203571: ASPxGridView - E4580 example - The EndCallback event is not called. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Petar Kosama at: 10/13/2016 2:34:04 AM    Hm, I tried it but I get an Exception in grid_HtmlRowPrepared because in this event I access another column and then.. Exception..

How could I solve this?

Thank you
Added By: Lex (DevExpress Support) at: 10/13/2016 3:27:52 AM    

Hello Petar,  

I've created a separate ticket on your behalf (T438787: ASPxGridView - Exception in the HtmlRowPrepared event handler). It has been placed in our processing queue and will be answered shortly.

Added By: salam samman at: 3/16/2017 11:33:47 PM    Hi all;
When i used this approach the hidden column still appear in filter builder control!!!
How can i hide the hidden column from filter builder also?
Added By: Larry (DevExpress Support) at: 3/16/2017 11:42:43 PM    

Hello,

I've created a separate ticket on your behalf (T493609: ASPxGridView - How to hide a grid column from filter control on the client side). It has been placed in our processing queue and will be answered shortly.

How to provide in-place editors for row headers in the vertical grid

$
0
0
This example demonstrates how to manually draw an editor in row headers and activate it after the mouse click.

ASPxReportDesigner - How to register a custom control in the Designer's toolbox

DXRichEdit for WPF: How to Print a Document using the DXPrinting Library

How to show the grandchildren collection in the DetailView

$
0
0

Suppose that we have the Master class, which has a one-to-many association with the Detail class. The Detail class has the one-to-many association with the SubDetail class. This example demonstrates how to show a collection of all SubDetail objects, associated with the Detail objects of the certain Master object, in the Master DetailView.
To implement this, an additional collection property - SubDetails - is implemented in the Master class. This collection is populated based on the Details collection when the SubDetails property is accessed for the first time and when the Details collection is changed. See the Master.cs file from this example for additional information.

See Also:
Creating Criteria
How to modify the E1448 example to filter Grandchildren ListView by selected children in the master DetailView

Viewing all 7205 articles
Browse latest View live


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