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

Tutorial - Creating a registration form using ASPxEditors

$
0
0

This solution is created to illustrate the steps described in the Creating a registration form using ASPxEditors. Introduction tutorial series.


The solution consists of the following projects:

ASPxEditorsTutorial.Part1 - The resulting project for the Creating a registration form using ASPxEditors. Part 1 - Create the registration form layout article

ASPxEditorsTutorial.Part2 - The resulting project for the Creating a registration form using ASPxEditors. Part 2 - Customizing editors and adding built-in client-side validation article

ASPxEditorsTutorial.Part3 - The resulting project for the Creating a registration form using ASPxEditors. Part 3 - Adding a Cascading Combo Boxes feature article

ASPxEditorsTutorial.Part4 - The resulting project for the Creating a registration form using ASPxEditors. Part 4 - Saving data to database article

ASPxEditorsTutorial.Part5 - The resulting project for the Creating a registration form using ASPxEditors. Part 5 - Implementing the password verification mechanism article

ASPxEditorsTutorial.Part6 - The resulting project for the Creating a registration form using ASPxEditors. Part 6 - Checking the entered email address article


Question Comments

Added By: Bharat Lakhani 1 at: 10/8/2014 9:35:25 AM    

Thanku  Very Much for u r Prompt and correct reply All doubts are clears

Added By: Larry (DevExpress Support) at: 10/8/2014 10:14:13 AM    You are always welcome!Added By: Jay Johnson at: 1/4/2017 6:03:05 PM    Where is the VB .dxsample file?

How to specify dashboard parameter values on the client side in the Web Viewer

$
0
0
This example demonstrates how to change dashboard parameter values in the Web Viewer on the client side using the ASPxClientDashboardViewer.GetParameters method.
In this example, current parameter values are specified between the ASPxClientDashboardViewer.BeginUpdateParameters and ASPxClientDashboardViewer.EndUpdateParameters method calls using the ASPxClientDashboardParameter.SetValue method.
Question Comments

Added By: Jonathan Barksdale at: 1/4/2017 9:17:19 PM    Thanks for this insight.  Any suggestions for a preferred method that could be used to store parameter values on the client site beforehand?  The client could then lookup this values and use them to set the parameter values when calling the dashboard.  Thanks...

How to modify the context menu of grid columns

$
0
0

The following example demonstrates how to customize the grid's context menu at runtime. For instance this sample demonstrates how to remove the default 'Show Column Chooser' menu item from the Column Context Menu, and add a custom item instead.

Question Comments

Added By: Sævar Kristinsson at: 2/6/2013 6:42:06 AM    

Hi, I would want to modify the column header context menu in design time. The only example I have found that touches this topic is this example or similar to it i.e. modifying the context menu in runtime. Could you guys give an example on how to do this in design time?

Added By: Thomas R Melinsky at: 5/27/2014 6:18:22 AM    

Is there a new version of this example for WPF that isn't event driven?

Added By: Ilya (DevExpress Support) at: 5/27/2014 9:08:19 AM    

Hi Thomas,
Currently, the approach demonstrated in his example is the appropriate way to customize the grid popup menu at runtime. Would you please clarify why it is not an option for you?

Added By: Adithya Kumar 1 at: 5/25/2015 10:45:03 PM    

Hi, how to add this into styles? So that the functionality is avialable to all the grids in an application.

Added By: Ivan (DevExpress Support) at: 5/26/2015 12:24:08 AM    

As I can see, you have recently created a similar ticket - T246541. I have updated it to describe your requirements. We will answer you there soon.

Added By: Ahmed Bayyari at: 1/25/2016 1:20:56 PM    

GridMenuEventArgs is obsolete. Could you please put an example using PopupMenuShowingEventArgs which DevExpress recommends to use instead of GridMenuEventArgs. The method e.Customizations doesn't exist when using PopupMenuShowingEventArgs.

Added By: Alexander S (DevExpress Support) at: 1/25/2016 11:26:37 PM    

Hi Ahmed,

The GridMenuEventArgs class is not obsolete and the TableView.ShowGridMenu event still uses this class. As for PopupMenuShowingEventArgs, this class is used in the RichEditControl.PopupMenuShowing event. So, the current implementation of the example is still actual.

Regards,
Alex

Added By: Ahmed Bayyari at: 1/26/2016 8:08:52 AM    

So looks like it was deprecated for the GridView but not the TableView? https://documentation.devexpress.com/#WindowsForms/DevExpressXtraGridViewsGridGridView_ShowGridMenutopic

Added By: Andrey Marten (DevExpress Support) at: 1/26/2016 11:14:42 AM    
Hello,

The link you referring to is about WinForms GridView and you are right that this event is obsolete in it. As for the TableView and other GridViewBase class descendants - the ShowGridMenu event is not obsolete and is recommended for use (if this is required). I suggest you refer to the corresponding documentation article: DataViewBase.ShowGridMenu Event.

Let us know if you have other questions.

Thanks,

AndreyAdded By: Mun Hou Loke at: 1/4/2017 9:23:07 PM    Do you know how to do this in descendant of GridControl using code behind?

How to show the ASPxPopupControl

$
0
0

This sample demonstrates several ways in which to show the ASPxPopupControl via a client-side or server-side event.

See Also:
How to show and hide a popup window via server side code

Question Comments

Added By: Esa Niemi at: 1/4/2017 11:25:03 PM    Are you really implying that the only way to turn the element visible is to poke at it with some javascript hack? 

How to custom draw in PDF Viewer

$
0
0
The PDF Viewer can draw graphics in the PDF document in the Control.Paint event handler.

In this example, the filled rectangle is drawn at any document space when you hold down the left mouse button and move it. 
Question Comments

Added By: Milind Wadge 1 at: 1/4/2017 11:34:31 PM    

After draw of rectangle, How can I save PDF document with drawn rectangle?.

How to dynamically build a persistent class from a DataSet and then bind it to the GridControl

$
0
0

This example is a variation of How to generate persistent classes at runtime based on a dataset with the difference that here we create a custom XPClassInfo class that provides metadata information for a type.
Then, we will use it to bind the GridControl to the XPServerCollectionSource, that is necessary to work in the Server Mode.

Question Comments

Added By: bbirbo at: 4/11/2016 8:21:06 AM    Is there any chance to modify this code so it runs with any sql statement like JOINS etc ?Added By: Andrew L (DevExpress Support) at: 4/12/2016 3:03:33 AM    

Hello,

I've created a separate ticket on your behalf (T366772: It is possible to use the approach described in E1729 so it runs with any sql statement like JOINS). It has been placed in our processing queue and will be answered shortly.

How to: Use DXBinding, DXCommand, DXEvent

$
0
0

This example demonstrates cases of the DXBinding, DXCommand, and DXEvent markup extensions.

Question Comments

Added By: Alexey Barkalov at: 1/5/2017 6:37:25 AM    Russian text in expression is shown as corrupted. Example of expression:
[XAML]
Title="{DXBindingExpr='`Маза2экземпляр`+InstanceNumber'}"


Report Storage for the End-User Report Designer

$
0
0

The following example demonstrates how to implement a report storage to persist report definitions in a database or in any other custom location. This may be useful when providing end-users with the capability to create and customize reports using XtraReports End-User Designer, if it is necessary to have a common target for saving and sharing all reports.

The default report serialization mechanism does not support the serialization of a report's data source. The following examples illustrate how you can provide a custom XML serialization logic for a report's data source as well as its custom parameters.

- How to implement custom XML serialization of a report that is bound to a dataset;

- How to serialize an XPO data source;

- How to serialize parameters of custom types.

Question Comments

Added By: (no info) at: 10/8/2012 10:48:21 AM    

There is a slight error in the example if you are using a different XPO provider. The call to create the XpoReportStorage is prior to setting the default DataLayer. This results in the default MS Access DataLayer being used in the XpoReportStorage parameter. Changing the statement (as indicated below) will result in the expected behavior:

string conn = SQLiteConnectionProvider.GetConnectionString(@"c:\temp\ReportStorage.sqlite");
XpoDefault.DataLayer = XpoDefault.GetDataLayer(conn, AutoCreateOption.DatabaseAndSchema);
reportStorage = new XpoReportStorage(new UnitOfWork());

Added By: Patrick Sollberger at: 7/6/2013 2:03:23 AM    

A hint for all those wo tried this with version 13.1.4:

This Example can not be built as-is using DevExpress 13.1.4 even after project conversion.

The ZipReportStorage.cs contains renamed classes:
- ZipFileCollection is now named InternalZipFileCollection
- ZipFile is now named InternalZipFile
- ZipArchive is now named InternalZipArchive

After renaming all occurences of those classes with the new names everything works just fine.

Added By: BINITR at: 10/25/2013 2:18:39 PM    

I'm trying to connect to the datasource Sqlite but I can not figure out how to do. I also downloaded the componeti OleDb for Sqlite but without result.

Added By: Wim Koppelaar at: 5/24/2015 2:59:21 AM    

Nice example of the possibillities. But I don't understand where StorageDataSet is comming from?

Added By: Vasily (DevExpress Support) at: 5/25/2015 5:56:39 AM    Hi Wim,

StorageDataSet is a regular DataSet class created by using the Visual Studio DataSet designer. Note that not all project files are usually displayed in the file selection combo box of the code example. So, if you have any questions regarding the example implementation, it is better to download the whole code example project and review its source code in the Visual Studio IDE. Please refer to the following ticket for more information: How to download code examples.

Added By: Yohan Dole 1 at: 12/17/2015 7:22:53 PM    

I tried to change the DataSet to a MS-SQL Table....but keep getting a "Cannot implicitly convert type 'ReportStorageSample.DataSet1.reportsRow' to 'ReportStorageSample.StorageDataSet.ReportStorageRow' " .. This is caused by the field "Buffer" which is varbinary on the DB side.

Added By: Jannet (DevExpress Support) at: 12/17/2015 10:37:11 PM    Hello Yohan,
To handle your inquiry in the most efficient manner, let's continue our discussion at Report & Sub Report stored in a Database Table.Added By: calub tollette at: 1/7/2017 11:47:31 AM    I have been fighting with this example for about two weeks. I opened a ticket and submitted code. maybe my questions were not understood.... If I replace the dataset with an sql dataset it doesn't write to the database no errors no write. if I use the connection string in the program.cs and enable the  
XpoDefault.DataLayer = XpoDefault.GetDataLayer(conn, AutoCreateOption.DatabaseAndSchema);
reportStorage1 = new XpoReportStorage(new UnitOfWork()); 
it ignores the dataset all to gather and creates 2 new tables.
what I need is an example to preform the same functions as this example except just using the sql dataset with id,url,buffer.
I looked at other examples like e698 that did no good and has a different table layout.

How to create a custom Table Of Contents for merged reports with page indexes

$
0
0
This code example illustrates how to create a custom "Table Of Contents" in a separate report.
It is necessary to create links between bricks of merged reports manually, after the reports are merged. Get the required bricks from the report using NestedBrickIterator and use the VisualBrick.NavigationPair property to create a link. To provide page indexes for such links, collect "page" bricks to a separate collection and then modify the VisualBrick.Text property value based on Target.Page.Index.
Question Comments

Added By: Kurt Stricker at: 1/7/2017 12:02:27 PM    This is a great example, thank you. However, try as I might, I cannot get the page number (in addition to the category text) to link to the page. Could you provide an update on how to do that?

How to sort a nested ListView at the business objects level, in code

$
0
0

This example demonstrates how to provide hidden and permanent sorting by a property in a nested ListView. Suppose we have Order and OrderItem classes that participate in an aggregated One-To-Many relationship.
We want to sort the collection of OrderItem objects by the ModifiedOn property, but do it in a way that end-users won't be able to see that the grid is sorted. Please see the sources of the Order class for more details on how to accomplish this. With this solution, sorting is implemented on the business objects level. Another variant is to use the approach from the How to sort a ListView in code example. This solution uses a specific ViewController.
Alternatively, you can use the Sorting property of the ListView application model element.

See Also:
How to prevent sorting and grouping by certain columns in a ListView

Web Dashboard - How to remove Items or Groups from the Toolbox

$
0
0
This example demonstrates how to remove certain items or groups from the Web Dashboard control's toolbox. To implement this functionality, it is necessary to execute the following steps:

1) Override the dx-dshd-item-placeholder knockout.js template.
2) Filter items inside the clientIDashboardControl.dashboardDesigner.toolbox observable array.

Web Dashboard - How to switch between dashboards using the ASPxListBox control

$
0
0
This example demonstrates how to implement a custom UI to switch between dashboards in the Web Dashboard control.

How to use the CustomDrawItem event to draw custom icons inside diagram items

$
0
0
This example demonstrates how to use the CustomDrawItem event to modify the standard drawing mechanism of diagram items (shapes, connectors, containers, etc.). In this example, a DiagramShape class descendant was created to introduce the Status property. Depending on the Status property value, a custom icon is drawn in the lower right-hand corner of a shape.


Important notes:The DefaultDraw method in the event args invokes certain parts of the standard shape drawing mechanism (the method parameter defines which ones). If you don't call this method, shape content, border and background will not be drawn.

To apply custom drawing logic defined in the CustomDrawItem event handler to your shapes, set the Handled property from the event args to true.

How to customize the underlying database provider options and data access behavior in XAF

$
0
0

IMPORTANT NOTE

This article describes some advanced customization techniques and low-level entities of the framework with regard to data access, which may be required in complex scenarios only.
So, if you just want to change the connection string, e.g. to use the Oracle instead of the Microsoft SQL Server database, then you would better refer to the Connect an XAF Application to a Database Provider article and documentation on your database provider instead. The XAF integration of supported ORM libraries is also described in the Business Model Design section of the framework's documentation.


Introducing IObjectSpaceProvider and IObjectSpace
XAF accesses data from a data store through special abstractions called - IObjectSpaceProvider and IObjectSpace.
The IObjectSpace is an abstraction above the ORM-specific database context (e.g., the DBContext used in Entity Framework or the Session in XPO) allowing you to query or modify data.
The IObjectSpaceProvider is a provider/creator of IObjectSpace entities, which also manages which business types these IObjectSpace are supposed to work with, how to set up the underlying connection to the database, create and update it and other low level data access options.



An XafApplication can use one or several IObjectSpaceProvider objects at the same time, and you can access this information through the XafApplication.ObjectSpaceProvder or XafApplication.ObjectSpaceProviders properties. Check out these help links to learn more on how to plug in custom IObjectSpaceProvider objects a well.

There are several built-in implementations of the IObjectSpaceProvider and IObjectSpace interfaces in our framework, which are usually specific to a target ORM (Entity Framework or XPO). I suggest you check out the source code of the default framework classes to better understand the role of the IObjectSpaceProvider:

...\DevExpress.ExpressApp.Xpo\XPObjectSpaceProvider.cs
...\DevExpress.ExpressApp.EF\EFObjectSpaceProvider.cs 

Typical customization considerations
You may want to provide a fully custom IObjectSpaceProvider implementation or inherit from the built-in implementors when you want to customize how data access is performed for a chosen ORM.
Below is a list of typical scenarios where a custom IObjectSpaceProvider may be required:

1. How to use XPO caching in XAF 
2. How to prevent altering the legacy database schema when creating an XAF application 
3. How to connect to remote data store and configure WCF end point programmatically 
4. How do I change the default schema in the database
5. How to use a custom ObjectSpace throughout the application by handling the CreateCustomObjectSpaceProvider event? 
6. How to connect different ORM data models to several databases within a single application

In most cases, it is not required to implement the IObjectSpaceProvider interface from scratch since you can inherit from existing implementors or customize/just their parts.


XPO-specific customizations

1. Implementing IXpoDataStoreProvider

For instance, in XPO one of such replaceable parts is the IXpoDataStoreProvider interface, which enables you to provide a custom or configured IDataStore object, which is used for underlying data access with this ORM:

[C#]
publicinterfaceIXpoDataStoreProvider{IDataStoreCreateWorkingStore(outIDisposable[]disposableObjects);IDataStoreCreateUpdatingStore(outIDisposable[]disposableObjects);stringConnectionString{get;}}

 

In its turn, XAF provides several ready to use implementations of this interface for most popular scenarios: 

1. ConnectionDataStoreProvider - can provide IDataStore by the IDbConnection object;

2. ConnectionStringDataStoreProvider - can provide IDataStore by just connecting string information;

3. MemoryDataStoreProvider - DataSet based in-memory IDataStore providers.


Technically, such an IXpoDataStoreProvider part is passed into the XPObjectSpaceProvider constructor as a parameter, which means that you can just customize it instead of re-implementing the whole XPObjectSpaceProvider logic.

Refer to the ...\DevExpress.ExpressApp.Xpo\XPObjectSpaceProvider.cs file within the XAF source code to better understand the role of this part.

2. Overriding XPO connection or database providers

To learn more on this approach, check out the Database Systems Supported by XPO help topic and How to create a custom XPO connection provider and then use it in an XAF application article in particular.  To learn more on customizing data access settings for XPO, please refer to the corresponding product documentation: Data Access Layer.



See Also:
Can I connect an XAF application to a custom data source (Web service, OData service, NoSQL database, etc.)?

Question Comments

Added By: Rejoice Supsup at: 9/16/2015 11:33:05 AM    

Is this intended to contain an empty example resource?

Added By: Dennis (DevExpress Support) at: 9/16/2015 11:46:15 AM    

Yes. This article originally contained an example, but it is now more like a KB article.

Added By: Rejoice Supsup at: 9/16/2015 12:00:10 PM    

Thank you for the quick reply. But I thought this might be misleading since it's categorized as an example. Should I expect that you're be providing an example in the future? If I may suggest, what about 2 databases:

#1 - Departments and Employees
#2 - Customers and Orders

Where #1 is integrated with the Security Module and #2 (used by XAF Win Forms) to manage CRM data but will be authenticated via DB #1.

Added By: Dennis (DevExpress Support) at: 9/16/2015 12:16:34 PM    

The category is to be changed in the future as the main purpose of this article is to describe the main concepts.
There are already multiple examples mentioned in this article - see under the "Typical customization considerations" section (no plans for new examples so far). I hope you find them helpful to implement your particular scenario. Should you have any further difficulties with your own implementation, please submit a separate ticket and attach your sample showing what you tried to do and what did not work as expected. Thanks.

How to override (handle) the customization form button click starting with the 15.1 version

$
0
0

This example is applied to version 15.1 and higher. If you are using an older version, please refer to the How to override (handle) the customization form button click example.

It is possible to accomplish this task by creating your custom Customization Form descendant. In this descendant create a custom ButtonPanel control and override its internal methods:

OnSaveLayoutButtonClick
OnLoadLayoutButtonClick
OnRedoButtonClick
OnUndoButtonClick

Note that inside ButtonPanels methods you can access a parent LayoutControl via the code snippet shown below:

[C#]
protectedoverridevoidOnSaveLayoutButtonClick(objectsender,EventArgse){//((LayoutControl)OwnerControl) - LayoutControl that shows your own Customization formFormform=((LayoutControl)OwnerControl).FindForm();//the form that contains a layout control (Form1 in this sample)base.OnSaveLayoutButtonClick(sender,e);}
Question Comments

Added By: Peter Niederberghaus at: 1/10/2017 12:45:20 AM    Hello DX Support Team,

in version 2016.2.3 this sample does not work any more.
In XtraUserControl1.OnLoad() property buttonsPanel1 is used, but does not exist any more in CustomizationForm.cs.
How to customize buttons now?

Kind Regards
Peter

How to prevent loading an untrusted custom assembly when binding to the Entity Framework data model

$
0
0
This example addresses securirty considerations that are specific to mail merge using data from Entity Framework data models contained in a compiled assembly.
Before loading the data assembly you should have an option to perform a path check to ensure that an assembly is obtained from a trusted source and that the path length is within valid limits.

When this example runs, it asks the user for permission to load the assembly. The first request is initiated by the GenerateMailMergeDocuments method, the second request occurs when the Spreadsheet Control attempts to populate its Field List. Each request fires the CustomAssemblyLoading event. The event handler asks the end-user for the permission and prompts whether the decision is final. If the decision is not final, the ICustomAssemblyLoadingNotificationService is used to grant or deny the permission to load the assembly.

How to implement real-time data server and use RTD worksheet function

$
0
0

This example illustrates how to set up and use RTD worksheet function. The Real-Time Data (RTD) function enables you to retrieve data in real time from a COM Automation server. The function result is updated when new data becomes available from the server.
The example contains the code of a simple RTD server that provides random data. You can revise the code or modify the server's GetValue method to implement complex scenarios.

To run the project, start the Microsoft Visual Studio as administrator. Elevated permissions are required to register COM server after it is built. Build the project, then run it.
The following animated image illustrates the resulting application.



In version 16.2 and higher you can use the SpreadsheetControl.Options.RealTimeData property to specify whether updates are manual or by timer, and set the time interval between updates.

GridView - How to manage a collection of expanded rows when the Master-Detail functionality is used

$
0
0

This example demonstrates a possible way of managing a collection of expanded rows when the Master-Detail functionality is used.





Implementation details.

Since GridView is implemented in the most optimal way, it is necessary to manage the state of its rows using methods provided by the GridView. Thus, to implement the GridView's rows state management, a bridge between the GridView object and ViewModel is required. Additionally, it is necessary to update the ViewModel's collection of expanded rows once a row is expanded \ collapsed on the GridView's side. To accomplish both of these tasks, the ExpandedMasterRowsManager helper class is implemented in the example.  

On the other hand, nothing special needs to be introduced on the ViewModel's side to implement the GridView's rows state management.


Below, you can find references to documentation, which provides descriptions of methods, events and features that are used in the example:

Fluent API
Commands 

Event-To-Command Behaviors
GridView.CollapseAllDetails
GridView.ExpandMasterRow
GridView.CollapseMasterRow
GridView.MasterRowExpanded
GridView.MasterRowCollapsed

How to bind the grid to Columns and Summaries specified in ViewModel

$
0
0
This example shows how to put columns and data summary definition logic in the ViewModel and setup the Grid Control.
Question Comments

Added By: DavidGG at: 6/20/2016 1:45:26 AM    Hi,

I have downloaded the vb.net version and it does not run.
System.Reflection.TargetInvocationException was unhandled
  
  Message=Exception has been thrown by the target of an invocation.
  
Any ideas?

Thanks
Added By: Elliot (DevExpress Support) at: 6/20/2016 1:57:34 AM    

Hello David,

I've created a separate ticket on your behalf (T393961: VB version of the T273154 code example does not compile). It has been placed in our processing queue and will be answered shortly.

Added By: Greyce at: 1/10/2017 5:31:57 AM    How the header columns appear with the words separated?
Lik:
FirstName appear First Name

How to force the ComboBoxEdit to post the selected value when the Tab key is pressed

$
0
0

This example demonstrates how to create a ComboBoxEdit that posts a value selected in the popup when the Tab key is pressed.

To enable this feature, we have created a ComboBoxEdit class descendant and overridden its ProcessPopupKeyDown method. In this method, we check which key was pressed by a user (we obtain it from the KeyEventArgs.Key property). If it's "Tab", we forcibly close the popup by using the ClosePopup method:

[C#]
protectedoverrideboolProcessPopupKeyDown(KeyEventArgse){if(e.Key==Key.Tab){if(IsPopupOpen)ClosePopup(PopupCloseMode.Normal);}returnbase.ProcessPopupKeyDown(e);}

Starting with version 16.1, you need to use the ProcessPopupPreviewKeyDown method instead.

Question Comments

Added By: John Genske at: 3/25/2016 2:14:50 PM    How do you achieve the same thing in the grid column?Added By: Alexander S (DevExpress Support) at: 3/28/2016 12:03:14 AM    Hi John,

As I see, you have created a separate thread for this inquiry: When using the keyboard in the WPF grid when using dxe:ComboBoxEditSettings Is there s similar fix for the grid Tab key doesn't commit value. We will answer you there,

Regards,
Alex
Viewing all 7205 articles
Browse latest View live


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