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

How to use the ASPxWebControl.CallbackError event to handle application-level errors occurred inside ASPxWebControls during callback processing

$
0
0

This example is an MVC version of the How to use the ASPxWebControl.CallbackError event to handle application-level errors occurred inside ASPxWebControls during callback processing WebForms solution.

It illustrates how to catch and handle:
- Exceptions that occur inside DevExpress ASP.NET MVC extensions during a callback using the ASPxWebControl.CallbackError event;
- The remaining unhandled exceptions using the Application_Error event in the Global.asax file.
It also shows how to write required information to the same log/storage (for further diagnostics, etc).


Global.asax:

[C#]
protectedvoidApplication_Start(){ASPxWebControl.CallbackError+=Application_Error;}

 

[VB.NET]
ProtectedSub Application_Start()AddHandler ASPxWebControl.CallbackError, AddressOf Application_ErrorEndSub

 

[C#]
protectedvoidApplication_Error(objectsender,EventArgse){Exceptionexception=HttpContext.Current.Server.GetLastError();if(exceptionisHttpUnhandledException)exception=exception.InnerException;AddToLog(exception.Message,exception.StackTrace);}

 

[VB.NET]
ProtectedSub Application_Error(ByVal sender AsObject, ByVal e As EventArgs)Dim exception As Exception = HttpContext.Current.Server.GetLastError()If TypeOf exception Is HttpUnhandledException Then exception = exception.InnerExceptionEndIf AddToLog(exception.Message, exception.StackTrace)EndSub



The only difference is the format of the callbackErrorRedirectUrl configuration option. It should be set according to the routing configuration:

Web.config:

[XML]
<configuration><devExpress>     <errorscallbackErrorRedirectUrl="/Home/Error"/>   </devExpress></configuration>



WebForms Version:
How to use the ASPxWebControl.CallbackError event to handle application-level errors occurred inside ASPxWebControls during callback processing

Question Comments

Added By: Mike McGrath at: 9/15/2015 9:11:57 AM    

Our application is a web forms.  What is required (DevExpress dlls) to support this

Added By: Sergi (DevExpress Support) at: 9/15/2015 9:20:42 AM    Hello Mike,

It seems that I provided you with the incorrect link in the T290000: ASPxUploadControl - The file upload cannot be completed due to an operation timeout - display this error to client ticket. I have updated the answer there.

GridView - How to perform a custom client side unobtrusive validation for the EditForm template using a custom attribute

$
0
0

Updated: 

Starting with version 14.1, unobtrusive validation works for built-in EditForm out of the box (see Support unobtrusive validation for the GridView's built-in edit form). You need to wrap GridView in a form and validation scripts will be automatically registered on a callback.

[C#]
@using(Html.BeginForm("Index","Home",FormMethod.Post,new{id="frm"})){@Html.Action("GridViewPartial")}


This example is based on the approach demonstrated in the E3744: How to enable unobtrusive validation for GridView using the EditForm template thread.
Perform the following steps to accomplish this task:
1) Create a ValidationAttribute class descendant.
2) Implement the IClientValidatable interface for this class to enable client side validation.
3) Write a custom adapter based on custom parameters that are passed from the server
4) Add a custom validation method

Below are some threads that may be helpful in accomplishing similar tasks:
Unobtrusive Client Validation in ASP.NET MVC 3
Unobtrusive client validation
Custom Unobtrusive jQuery Validation with Data Annotations in MVC 3
Creating custom unobtrusive file extension validation in ASP.NET MVC 3 and jQuery
GridView - How to enable unobtrusive validation for inline edit form

How to speed up Windows Forms applications, running in a Remote Desktop Services (formerly known as Terminal Services) environment

$
0
0

To achieve this goal, you can disable visual styles, skins, animations, and set various controls options. Note that here we additionally disable visual effects of two most "expensive" controls: RibbonControl and BarManager, which provide bars, docking functionality, context menus, alert windows and a Ribbon interface for your .NET WinForms applications. The attached example shows how to do this by an example of an XAF Windows Forms application. If you do not use XAF, then you can obtain the necessary code from this example, and put it in the entry point of your application (usually it's the Main method).

IMPORTANT NOTE
1. You can greatly reduce memory consumption if you use the BarManager instead of RibbonControl on your forms. For example, an XAF Windows Forms application with BarManager consumes half as much memory than the same application using the RibbonControl. In XAF you can switch between the standard bars and ribbon menu using the FormStyle property of the Options node in the Model Editor.
2. To avoid painting problems when using the RibbonForm and RibbonControl on Vista or Windows 7 with the Aero theme enabled, don't set the System.Windows.Forms.Application.VisualStyleState property to VisualStyleState.NoneEnabled. Alternatively, you can set the RibbonForm.AllowFormGlass property to false. This is because we use the VisualStyleRenderer to draw text on transparent headers.

See Also:
Add a new static property to the XtraAnimator class which will allow a developer to disable animation in all DevExpress controls
Performance Tuning CPU Use for 16 and 32-bit Windows Applications
Build Your Skills: How to optimize apps to run in Terminal Services
Tuning applications for the Terminal Services
Performance Tuning Guidelines for Windows Server 2008

Question Comments

Added By: Carlitos at: 3/9/2015 10:19:37 PM    

I am trying this code in my windows client but can't get it to work. In the ResolveTemplate method the formTemplate is always null because the IFrameTemplate template is DevExpress.ExpressApp.Win.Templates.Bars.MainFormV2

Added By: Dennis (DevExpress Support) at: 3/10/2015 5:49:28 AM    

@Carlos: Starting with v14.2, new templates for the main and detail forms are used in XAF. So, you should check for the RibbonForm type instead of the XtraFormTemplateBase one from within the ResolveTemplate method when customizing the ribbon template. I have attached the updated code below. We'll consider updating this example accordingly in the future.


[C#]
usingDevExpress.ExpressApp;usingDevExpress.ExpressApp.Templates;usingDevExpress.ExpressApp.Win.Controls;usingDevExpress.LookAndFeel;usingDevExpress.Skins;usingDevExpress.XtraBars;usingDevExpress.XtraBars.Controls;usingDevExpress.XtraBars.Ribbon;namespaceDisableVisualStylesModule.Win{publicclassDisableVisualStylesWindowController:WindowController{publicDisableVisualStylesWindowController(){TargetWindowType=WindowType.Main;}protectedoverridevoidOnActivated(){base.OnActivated();DisableVisualStyles();}protectedoverridevoidOnDeactivated(){base.OnDeactivated();Application.CustomizeTemplate-=Application_CustomizeTemplate;}privatevoidApplication_CustomizeTemplate(objectsender,CustomizeTemplateEventArgse){ResolveTemplate(e.Template);}protectedvirtualvoidDisableVisualStyles(){if(System.Windows.Forms.SystemInformation.TerminalServerSession){Application.CustomizeTemplate+=Application_CustomizeTemplate;InitGlobalOptions();}}protectedvirtualvoidInitGlobalOptions(){Animator.AllowFadeAnimation=false;SkinManager.DisableFormSkins();SkinManager.DisableMdiFormSkins();BarAndDockingController.Default.PropertiesBar.MenuAnimationType=AnimationType.None;BarAndDockingController.Default.PropertiesBar.SubmenuHasShadow=false;BarAndDockingController.Default.PropertiesBar.AllowLinkLighting=false;System.Windows.Forms.Application.VisualStyleState=System.Windows.Forms.VisualStyles.VisualStyleState.NoneEnabled;}privatevoidResolveTemplate(IFrameTemplatetemplate){IBarManagerHolderformTemplate=templateasIBarManagerHolder;if(formTemplateisRibbonForm){InitRibbonOptions(((RibbonBarManager)formTemplate.BarManager).Ribbon);}else{InitBarOptions(formTemplate.BarManager);UserLookAndFeel.Default.SetWindowsXPStyle();}}protectedvirtualvoidInitRibbonOptions(RibbonControlribbon){if(ribbon!=null){ribbon.ItemAnimationLength= 0;ribbon.GroupAnimationLength= 0;ribbon.PageAnimationLength= 0;ribbon.ApplicationButtonAnimationLength= 0;ribbon.GalleryAnimationLength= 0;ribbon.TransparentEditors=false;InitBarOptions(ribbon.Manager);}}protectedvirtualvoidInitBarOptions(BarManagermanager){if(manager!=null){manager.AllowItemAnimatedHighlighting=false;}}}}
Added By: Carlitos at: 3/10/2015 11:22:35 AM    

Thank you Dennis! Works like a charm!!!

Added By: Arjan van Dijk at: 7/14/2015 2:40:57 PM    

You can also consider ngen.exe to speed up

Added By: Paul Berger at: 9/15/2015 10:02:14 PM    

Is there an article like this for VCL?

Added By: Dennis (DevExpress Support) at: 9/16/2015 1:06:48 AM    

@Paul: To process your recent post more efficiently, I created a separate ticket on your behalf: T290221: How to speed up application under Remote Desktop Services (formerly known as Terminal Services) environment. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to bind ASPxGridView with XmlDataSource

$
0
0

This demo is based on the GridView Examples for ASP.NET 2.0: Accessing Data with the DataSource Controls MSDN article. It illustrates how to bind the ASPxGridView with the XmlDataSource control.
The ASPxGridView generates its column automatically for the following XmlDataSource's structure:

[XML]
<root><DataItemfield1="...".../></root>

 

[ASPx]
<dx:GridViewDataTextColumnFieldName="field1"/>


If it's necessary to bind the ASPxGridView with the XmlDataSource whose structure is non-standard:

[XML]
<root><DataItem><field1>...</field1></DataItem></root>


1) Use the XSLT technology to transform the underlying XML file in the required manner:

[XML]
<?xmlversion="1.0"encoding="utf-8"?><xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:templatematch="/"><items><xsl:for-eachselect="//DataItem"><itemfield1="{field1}"/></xsl:for-each></items></xsl:template></xsl:stylesheet>


2) Use the GridViewColumn's DataItemTemplate and an XPath expression:

[ASPx]
<dx:GridViewDataTextColumnFieldName="field1"><DataItemTemplate><%#XPath("field1")%></DataItemTemplate></dx:GridViewDataTextColumn>


To allow ASPxGridView sorting, it's necessary to implement the IXPathNavigable interface for the ASPxGridView.DataSource's type. Please refer to the XPath Querying Over Objects with ObjectXPathNavigator MSDN article regarding this.

See Also:
How to bind ASPxGridView with Xml Document via ObjectDataSource
How to show long text in the PreviewRow using the ASPxCallback control

GridView - How to toggle Auto Filter Row visibility

$
0
0

Starting with v2014 vol 1 (v14.1), it is much easier to accomplish this task via the built-in Context Menu -> Filter Row command. Please refer to the ASP.NET: GridView Context Menu (What's new in 14.1) blog post to learn more about this new feature and the online Context Menu demo to see it in action.

This example illustrates how to toggle the Auto Filter Row visibility via a custom MVC GridView callback.

- Initialize the expected Auto Filter Row visibility via the ViewData key when a View is loaded for the first time;
- Set the CheckBox state according to the ViewData key value;
- Load the GridView's PartialView via the Html.Action method and pass the ViewData key as a parameter;
- Set the Auto Filter Row visibility according to the ViewData key;
- Handle the client-side ASPxClientCheckBox.CheckedChanged event;
- Perform a custom GridView callback via the client-side ASPxClientGridView.PerformCallback method;
- Handle the client-side ASPxClientGridView.BeginCallback event;
- Pass the CheckBox' checked state as a parameter (Passing Values to Controller Action Through Callbacks);
- Handle the GridViewSettings.CustomActionRouteValues.Action method and retrieve the passed parameter. In general, it is possible to use the Action method specified for all GridView callbacks (GridViewSettings.CallbackRouteValues.Action). The illustrated technique allows handling a custom GridView's callback within a separate Action method, whose signature can be different. Usually, custom callbacks are used for changing the GridView's state programmatically in a custom manner (like here - toggling the Auto Filter Row visibility);
- Pass the required Auto Filter Row visibility state via the ViewData key back to the GridView PartialView.

How to integrate a gauge control for visualizing a value of a business class property

$
0
0

Scenario
This example demonstrates a possible integration of the DevExpress gauge controls in XAF for representing various types of business class properties. For this, custom WinForms and ASP.NET PropertyEditor classes were implemented:


Steps to implement

1. Copy and include the GaugePropertyEditor.Win and GaugePropertyEditor.Web projects into your solution and make sure it is built successfully.

2. Invoke the Application Designer for the YourSolutionName/WinApplication.xx file by double-clicking it in the Solution Explorer. Invoke the Toolbox (Alt+X+T) and then drag & drop the GaugePropertyEditorWindowsFormsModule component into the modules list on the left.
3. Invoke the Application Designer for the YourSolutionName/WebApplication.xx file by double-clicking it in the Solution Explorer. Invoke the Toolbox (Alt+X+T) and then drag & drop the GaugePropertyEditorAspNetModule component into the modules list on the left.
4. Define a string persistent property within your business class and decorate it with the DevExpress.Persistent.Base.EditorAliasAttribute passing the corresponding PropertyEditor alias string as a parameter. See the WinWebSolution.Module\GaugeDemoObject.cs .xx file for an example.



 

See Also:
PropertyEditor Class
Class ASPxGaugeControl
Class GaugeControl
PropertyEditors - Integrate gauge controls
eXpressApp Framework > Concepts > UI Construction > Using a Custom Control that is not Integrated by Default

Question Comments

Added By: MohammedFarooq at: 9/16/2015 5:14:32 AM    

Hi,

This is a good topic and I have planned to use it on my project. I would like to know how can i set the guage min & max values from the business object? Could you please advice me on how to set it up from the BO

Added By: Dennis (DevExpress Support) at: 9/16/2015 7:53:14 AM    @Mohammed: You can introduce your own code attributes and mark your business class properties with them to later read the attributes settings via the this.MemberInfo.FindAttribute<YourAttributeType> method within the PropertyEditor class context where you can adjust the gauge control accordingly.

How to use DateTimeNavigation service

$
0
0

This example shows how to implement forward/back navigation to navigate a "displayed" time frame (month, day, week, etc.) at a time. It uses the IDateTimeNavigationService which provides two methods - NavigateForward, which advances forward in time as suggested by the current view, and NavigateBackward, which steps back in time. 

You can also use the SchedulerControl.Services.DateTimeNavigation.NavigateBackward() and SchedulerControl.Services.DateTimeNavigation.NavigateForward() notation to call the service methods.

See Also:
DateTime Navigation Services

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.

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 show a hyper link (URL, email, etc.) for a business class property

$
0
0

Scenario
The following basic functionality is implemented in the HyperLinkPropertyEditor.Web and HyperLinkPropertyEditor.Win modules:

1. Custom PropertyEditor classes for WinForms and ASP.NET based on the HyperLinkEdit and ASPxHyperLink controls that can be used for representing object fields, containing email address or a URL in the UI.
2. To validate an input, a combined RexEx mask is used in both ListView and DetailView of Windows Forms and ASP.NET applications. The default regular expression is the following:
(((http|https|ftp)\://)?[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&amp;amp;%\$#\=~])*)|([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})
You can use it as is or modify it per your specific needs. Look for Regular Expressions in MSDN for more information on how to do this.
3. The default email client or default browser window is opened after a single click on the hyperlink if it represents a valid email or web address. For end-users convenience, in DetailView of Windows Forms projects, a double-click is necessary to be able to easily edit the field.



Steps to implement

1. Copy and include the HyperLinkPropertyEditor.Web and HyperLinkPropertyEditor.Win projects into your solution and make sure it is built successfully.

2. Invoke the Application Designer for the YourSolutionName/WinApplication.xx file by double-clicking it in Solution Explorer. Invoke the Toolbox (Alt+X+T) and then drag & drop the HyperLinkPropertyEditorWindowsFormsModule component into the modules list on the left.
3. Invoke the Application Designer for the YourSolutionName/WebApplication.xx file by double-clicking it in Solution Explorer. Invoke the Toolbox (Alt+X+T) and then drag & drop the HyperLinkPropertyEditorAspNetModule component into the modules list on the left.
4. Define a string persistent property within your business class and decorate it with the DevExpress.Persistent.Base.EditorAliasAttribute passing the "HyperLinkStringPropertyEditor" string as a parameter. See the E2096.Module\HyperLinkDemoObject.xx file for an example.

 

 

See Also:
PropertyEditor Class
Class HyperLinkEdit
Class ASPxHyperLink
Access Editor Settings
PropertyEditors.HyperLink - Introduce the capability to show/edit a string which represents an URL or "e-mail" (DetailView/ListView and WinForms/ASP.NET)

How to implement an editable ASPxPivotGrid

$
0
0

This example demonstrates how to allow end-users to modify data cell values within the ASPxPivotGrid.

Question Comments

Added By: Mike S CBO at: 4/14/2015 12:26:47 PM    

This is great. How would we do the same thing assuming there was more than one field in the column area. How would I pass the column name to the ChangeCellValue method instead of hard coding the "UnitPrice" field?

Added By: John (DevExpress Support) at: 4/14/2015 11:39:15 PM    It seems that you have already asked this question in a separate ticket: Editing multiple fields in PivotGrid data. Let's continue the conversation there.Added By: John Daren Dizon 1 at: 9/16/2015 8:11:55 PM    

How can I edit cells which don't have values yet? 'coz in this example, you can only edit cells which has values in it..

Added By: Uriah (DevExpress Support) at: 9/16/2015 10:43:28 PM    

Hello John Daren,

To process your recent post more efficiently, I created a separate ticket on your behalf: T290587: E1949 - How to edit cells which don't have values yet. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to display check boxes for legend items, to control the visibility of series

$
0
0

This example demonstrates how you can accompany each legend item with a check box, which controls the visibility of the corresponding series (obsolete approach).

Note that starting with the DXperience version 13.2.1, the chart control supports a built-in check box in the Legend feature. For more details, see the Legend Check Box topic.  
Question Comments

Added By: Alexander Koshmelev at: 9/18/2015 3:54:21 AM    

Hi!

Please show an example of "seriesCollectionToListOfLegendItemPresentationConverter".

Added By: Alex (DevExpress Support) at: 9/18/2015 3:58:57 AM    Hi Alexander,

The corresponding source file should be available on the web page. Please review it.

How to get a list of names of selected files if ASPxUploadControl operates in multi-file selection mode

$
0
0

This example demonstrates how to get a list of names of selected files if ASPxUploadControl operates in multi-file selection mode


Question Comments

Added By: Stuart Duncan at: 8/8/2013 3:14:05 AM    

This works, however it seems to remove any spaces in the filenames. Changing the pipe character to a question mark in the replace pattern seems to correct this.

Added By: David Hoffmann at: 9/18/2015 7:26:43 AM    

The problem is, that "," (comma) is allowed in filenames!

How to use the LayoutView/CardView as a master View in master-detail mode

$
0
0

This example illustrates how to emulate a master-detail mode for the LayoutView/CardView.

Question Comments

Added By: Marcus Gabriel at: 8/20/2013 11:44:10 AM    

A screenshot how the result looks would help to quickly find out if this sample is what someone is looking for.

Added By: Svetlana (DevExpress Support) at: 8/20/2013 1:05:06 PM    

Hi,

I have added an image showing how the application works. Thank you for your idea.

Added By: Sean Birmingham 1 at: 8/8/2015 5:33:30 PM    

I am attempting a similar solution but the layout view (lvPictures) is itself a detail view (of gvLocation) and I want the detail grid view displayed in the PopupContainerControl to be a view (gvPicTags) I've created in the grid designer that itself uses editors created in the grid designer's In Place Editor Repository to add/update/delete records in gvPicTags.  Is this possible?

I've implemented the solution posted here to display the detail grid but doesn't appear to be picking up the grid layout (gvPicTags) I've created.  It does however display the raw data correctly...

Added By: Sean Birmingham 1 at: 8/8/2015 6:14:13 PM    

Funny, sometimes writing a question helps clarify the solution...

In the lvPictures_GotFocus I execute:

       helper = New MasterDetailHelper(layoutView1, ViewType.Grid, gvPicTags)
       helper.CreateDetail()

LayoutView1 is the sender object (lvPictures) and I added an additional parameter referencing the detail grid view (gvPicTags) which I created in the designer.  In CreateView() I changed the detailView_Renamed assignment for GridView from New GridView(DetailGrid) to the detailGridView (gvPicTags) which I passed via the new parameter.

Added By: Svetlana (DevExpress Support) at: 8/10/2015 9:57:22 AM    Thank you for informing us that the issue has been resolved. Please do not hesitate to contact us in case of any difficulty. Added By: Sean Birmingham 1 at: 9/18/2015 4:22:50 PM    

I've implemented as detailed above with a grid that allows rows to be added and deleted.  The PopupEditContainer resizes on popup but I'm stumped how to resize the contianer when a row has been added or deleted without closing the container.  Is this possible and how can I modify the code to resize the PopupContainerEdit when a row is added or deleted?

How to: Use the ParentPath Property to Enable the Binding from the ViewModel to Grid

$
0
0
In this example, the ParentPath is set to the MasterItem property that contains the reference to its master item. Thus, the master grid can determine the detail grid in which the current item is to be updated.

WinForms End-User Report Designer - How to hide a property in the Properties window

$
0
0
This example demonstrates how to hide connection (ConnectionName and ConnectionParameter) properties of the SqlDataSource component set as a a report's data source.

You can customize the Properties window for the report's End-User Designer, so only required properties are displayed.
The How to: Hide Properties from End-Users in the Report Designer example illustrates how to implement this. The idea is to handle the static XtraReport.FilterComponentProperties event and hide (or remove) an unnecessary property from the entire control's properties collection.
Please note that this approach is applicable for a report, its bands and XRControls (XRControl class descendants).

If you want to hide properties for a non-XRControl descendant, for instance, for the report's data source, we recommend the following. 
In the XRDesignMdiController.DesignPanelLoaded event handler, substitute the default ITypeDescriptorFilterService object with your custom one. In this custom ITypeDescriptorFilterService class, override the FilterProperties method to remove unnecessary properties.

See also:
Customize an End-User Report Designer


WPF: WPF Report Designer - How to hide a property in the Properties window

How to implement a drill-down feature for an ASP.NET MVC web report

$
0
0

This example demonstrates how you can implement a Drill-Down feature for a report displayed in the ASP.NET MVC DocumentViewer extension.

IMPORTANT NOTE:
Starting with version 15.1, our Reporting Suite provides the Drill-Down functionality out of the box. So, use the approach demonstrated in the How to: Create a Drill-Down Report help topic instead of using the approach demonstrated in this code example.


The main idea of this approach is to store the expanded state of report categories. As this is a web application, a Session is used to store it. Then depending on the category's expanded state its product list is shown or hidden. The DetailReportBand.BeforePrint event handler is used for this purpose.


To make the expand/collapse button working in a web report its HtmlItemCreated event handler is used to add required HTML attributes to it. When the expand button is clicked a client-side function is executed and a callback is sent to the CallbackPanel. In the controller, the expanded state of report categories is updated, and the report is updated.

OBSOLETE - How to set the size of the popup window shown via the PopupWindowShowAction in WinForms

$
0
0

==========================================
This example is now obsolete. Instead, refer to the How to: Adjust the size of pop up dialogs  example.
==========================================
To accomplish this you can handle the CustomizeTemplate event of the PopupWindowShowAction or XafApplication classes and access the actual template to set its size as needed.

See Also:
How to Show a Window via an Action

Question Comments

Added By: Mario Blatarić at: 7/30/2013 5:08:24 AM    

Could you create Web example as well?
It seems this is not as straightforward for Web.

Added By: Dennis (DevExpress Support) at: 7/31/2013 2:38:35 AM    

Thanks for the feedback, we will consider updating this example to include a solution from the http://documentation.devexpress.com/#Xaf/CustomDocument3456 help article.

Added By: Hitha at: 6/24/2014 3:31:43 AM    

Hi,
  I have set the size as per your code but that is not the size I see when the pop window is shown.
((PopupForm)e.Template).Size = new System.Drawing.Size(400, 130);
Added to that if I have enabled IsSizeable then the window size is properly set(but not set to 400,130) without empty space and if IsSizeable is disabled then it is set to some random value with empty space below/above.

Please suggest a way around this. thanks

Added By: Dennis (DevExpress Support) at: 6/24/2014 7:03:06 AM    @Hitha: I suggest you additionally handle the HandleCreated event as demonstrated in the How to define the size of a popup ticket. I hope this helps.

How to implement CRUD operations when WcfInstantFeedbackDataSource or WcfServerModeDataSource is used

$
0
0

This example shows how to use WcfInstantFeedbackDataSource or WcfServerModeDataSource with DXGrid, and how to implement CRUD operations (e.g., add, remove, edit) in your application via special behavior.
The test sample requires the SQL Express service to be installed on your machine.

We have created the WCFServerModeCRUDBehavior and WCFInstantModeCRUDBehavior attached behaviors for GridControl. For instance:

[XAML]
<dxg:GridControl><i:Interaction.Behaviors><crud:WCFServerModeCRUDBehavior...><crud:WCFServerModeCRUDBehavior.DataSource/><dxsm:LinqServerModeDataSource.../></crud:WCFServerModeCRUDBehavior.DataSource></crud:WCFServerModeCRUDBehavior></i:Interaction.Behaviors></dxg:GridControl>

 

The WCFServerModeCRUDBehavior and WCFInstantModeCRUDBehavior classes contain the NewRowForm and EditRowForm properties to provide the "Add Row" and "Edit Row" actions. With these properties, you can create the Add and Edit forms according to your requirements:

[XML]
<DataTemplatex:Key="EditRecordTemplate">    <StackPanelMargin="8"MinWidth="200">        <Grid>            <Grid.ColumnDefinitions>                <ColumnDefinition/>                <ColumnDefinition/>            </Grid.ColumnDefinitions>            <Grid.RowDefinitions>                <RowDefinition/>                <RowDefinition/>            </Grid.RowDefinitions>            <TextBlockText="ID:"VerticalAlignment="Center"Grid.Row="0"Grid.Column="0"Margin="0,0,6,4"/>            <dxe:TextEditx:Name="txtID"Grid.Row="0"Grid.Column="1"EditValue="{Binding Path=Id, Mode=TwoWay}"Margin="0,0,0,4"/>            <TextBlockText="Name:"VerticalAlignment="Center"Grid.Row="1"Grid.Column="0"Margin="0,0,6,4"/>            <dxe:TextEditx:Name="txtCompany"Grid.Row="1"Grid.Column="1"EditValue="{Binding Path=Name, Mode=TwoWay}"Margin="0,0,0,4"/>        </Grid>    </StackPanel></DataTemplate><crud:WCFServerModeCRUDBehaviorNewRowForm="{StaticResource ResourceKey=EditRecordTemplate}"EditRowForm="{StaticResource ResourceKey=EditRecordTemplate}"/>

This Behavior classes require the following information from your data model:
- EntityObjectType - the type of rows;
- DataServiceContext - an object of the DataServiceContext type;
- PropertiesList - the table columns' list;
- PrimaryKey - the primary key of the database table;
- DataSource - an object of the WcfInstantFeedbackDataSource or WcfServerModeDataSource type.

[XML]
<dxg:GridControl><i:Interaction.Behaviors><crud:WCFInstantModeCRUDBehaviorEntityObjectType="{x:Type sr:Item}"DataSource="{Binding ElementName=wcfInstantSource}"DataServiceContext="{Binding DataSource.DataServiceContext, RelativeSource={RelativeSource Self}}"/></i:Interaction.Behaviors></dxg:GridControl>
[C#]
helper.PropertiesList.Add("Id");helper.PropertiesList.Add("Name");

See the WcfInstantFeedbackDataSource and WcfServerModeDataSource classes to learn more about WcfInstantFeedbackDataSource and WcfServerModeDataSource .

Behavior class descendants support the following commands: NewRowCommand, RemoveRowCommand, EditRowCommand. You can bind your interaction controls with these commands with ease. For instance:

[XML]
<crud:WCFServerModeCRUDBehaviorx:Name="helper"/><StackPanelGrid.Row="1"Orientation="Horizontal"HorizontalAlignment="Center"><ButtonHeight="22"Width="60"Command="{Binding Path=NewRowCommand, ElementName=helper}">Add</Button><ButtonHeight="22"Width="60"Command="{Binding Path=RemoveRowCommand, ElementName=helper}"Margin="6,0,6,0">Remove</Button><ButtonHeight="22"Width="60"Command="{Binding Path=EditRowCommand, ElementName=helper}">Edit</Button></StackPanel>

By default, the WCFServerModeCRUDBehavior and WCFInstantModeCRUDBehavior solutions support the following end-user interaction capabilities:
1. An end-user can edit selected row values by double-clicking on a grid row or by pressing the Enter key if the AllowKeyDownActions property is True.
2. An end-user can remove selected rows via the Delete key press if the AllowKeyDownActions property is True.
3. An end-user can add new rows, remove and edit them via the NewRowCommand, RemoveRowCommand, and EditRowCommand commands.

Question Comments

Added By: Claire N Streb at: 8/12/2012 9:03:43 AM    

Just in case anyone else experiences this problem, I received this error when trying to attach the provided Database.mdf file to the SQL Server database: The database '[snip]\DATABASE.MDF' cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported. To fix it, I opened the model, generated the database from the model, added the database into SQL Server under a different name, excluded Database.mdf from the solution, added the newly created database to the solution, and changed the web.config file.

How to apply master filtering in ASPxDashboardViewer

$
0
0

The following example demonstrates how to apply master filtering in ASPxDashboardViewer on the client side.


In this example, the ASPxClientDashboardViewer.SetMasterFilter method is used to select required rows in the Grid dashboard item while the ASPxClientDashboardViewer.SetRange method is called to select the required range in the Range Filter dashboard item. These methods are called in the Click event handler of the ASPxButton1.

Question Comments

Added By: Mariusz Muszalski at: 10/2/2014 2:16:32 AM    

An exception is raised when trying to set master filter values for more than one items:

Emex.Framework.Web.UI.JavaScriptException: Cannot perform interactivity action. This action is not allowed for the current dashboard item.: at document path 'http://localhost:51001/BI/Dashboard3.aspx';. at ('Cannot perform interactivity action. This action is not allowed for the current dashboard item.', 'http://localhost:51001/DXR.axd?r=1_171,1_94,1_164,1_114,1_121,1_113,1_91,1_156,1_154,1_116,1_93,1_131,15_1,1_128,1_127,15_0,15_5,15_6-qtFv9', '23815', '1803', 'Error: Cannot perform interactivity action. This action is not allowed for the current dashboard item.') at ()

<ClientSideEvents Click="function(s, e) {
WebViewer.SetMasterFilter('gridDashboardItem1',[['UK','Anne Dodsworth'],['USA','Andrew Fuller']]);
WebViewer.SetMasterFilter('gridDashboardItem2',[['UK','Anne Dodsworth'],['USA','Andrew Fuller']]);
           }" />

Added By: Andrew Aks (DevExpress) at: 10/2/2014 3:30:04 AM    I have extracted your question into a separate thread:
https://www.devexpress.com/Support/Center/Question/Details/T157091
Let's continue our discussion there.

How to apply master filtering in MVCxDashboardViewer

$
0
0

The following example demonstrates how to apply master filtering in MVCxDashboardViewer on the client side.


In this example, the ASPxClientDashboardViewer.SetMasterFilter method is used to select required rows in the Grid dashboard item while the ASPxClientDashboardViewer.SetRange method is called to select the required range in the Range Filter dashboard item. . The SettingsBase.Name property value is used to access the extension client object on the client side.
Click the SetMasterFilter button to apply master filtering.

Viewing all 7205 articles
Browse latest View live


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