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

How to provide custom summary values for Total, Grand Total and ordinary cells

$
0
0

This example is made using the ASPxPivotGrid control. This approach can be used with XtraPivotGrid and DXPivotGrid controls. When the CustomSummary event is used to provide custom values for only Total or Grand Total cells, you can use the PivotGridCustomSummaryEventArgs.ColumnField and PivotGridCustomSummaryEventArgs.RowField properties to determine the kind of a processed cell. You can use the following rules to determine that a cell is being processed:

1. If ColumnField or RowField is null, it means that this is a Grand Total cell;
2. If both ColumnField and RowField are last fields in a corresponding area, this means that this is an ordinary cell.
3. In other cases, this is a Total cell.

See Also:
T158425: How to calculate Total cell values based on the low level Сell summary values   

Question Comments

Added By: Eurofins Lancaster Labs at: 10/12/2012 10:16:06 AM    

How can we override the bottom right grand total (total of grand totals)?

Added By: Eurofins Lancaster Labs at: 10/12/2012 11:17:42 AM    

Nevermind, I just had to loop through the items in the drill down data source.


ASPxGridView - How to make some field editors read-only when editing a row and allow their editing when adding a new row

$
0
0

This example demonstrates how to set the editor's ReadOnly property based on the grid's state. I.e. it is possible can edit field value while adding a new row, but this editor becomes ReadOnly if we trying to edit existing row.


It is used the ASPxGridView.CellEditorInitialize event to implement this scenario:

[C#]
protectedvoidgridView_CellEditorInitialize(objectsender,DevExpress.Web.ASPxGridView.ASPxGridViewEditorEventArgse){ASPxGridViewgrid=senderasASPxGridView;if(e.Column.FieldName=="CategoryID")e.Editor.ReadOnly=!grid.IsNewRowEditing;}

Question Comments

Added By: Ju Yeong Jeong at: 1/15/2015 1:00:32 AM    

It's so good example.

Thank you so much !!!

[ASPX]

<dx:ASPxGridView ID="grid" ClientInstanceName="grid" ....
KeyFieldName="MST_CD" OnCellEditorInitialize="grid_CellEditorInitialize">

<dx:ASPxGridView ID="gridDetail" ClientInstanceName="gridDetail" ....
KeyFieldName="MST_CD;CD" OnCellEditorInitialize="grid_CellEditorInitialize">

[C#]
   protected DataTable dtGrid = null;
   protected DataTable dtGridDetail = null;

   protected void Page_Load(object sender, EventArgs e)
   {
       if (! Page.IsPostBack)
       {
               //GET DATATABLE
               dtGrid = dataset.Tables[0];
               //SET PRIMARY KEY(S)
               dtGrid.PrimaryKey = new DataColumn[] { dtGrid.Columns["MST_CD"] };
               //SET SESSION
               Session["DataSet"] = dtGrid;

               dtGridDetail = dataset2.Tables[0];
               dtGridDetail .PrimaryKey = new DataColumn[] { dtGrid.Columns["MST_CD;CD"] };
               Session["DataSetDetail"] = dtGridDetail ;
       }
       else
       {
           dtGrid = (DataTable)Session["DataSet"];
           dtGridDetail = (DataTable)Session["DataSetDetail"];
       }

       grid.DataSource = dtGrid;
       grid.DataBind();

       gridDetail.DataSource = dtGridDetail;
       gridDetail.DataBind();
   }

   /// <summary>
   /// Prevent Editing of the Key Column(s) on Cell Updating
   /// </summary>
   /// <param name="sender"></param>
   /// <param name="e"></param>
   protected void grid_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e)
   {
       ASPxGridView oGrid = sender as ASPxGridView;

       string sSession = string.Empty;

       if ("grid" == oGrid.ClientInstanceName )
       {
           sSession = "DataSet";
       }
       else if ("gridDetail" == oGrid.ClientInstanceName)
       {
           sSession = "DataSetDetail";
       }

       DataTable oDt = (DataTable)Session[sSession];
       
       for (int i = 0; i < oDt.PrimaryKey.Length; i++)
       {
           if (e.Column.FieldName == oDt.PrimaryKey[i].ColumnName)
           {
               e.Editor.ReadOnly = !oGrid.IsNewRowEditing;
               return;
           }
       }
   }

How to filter a LookUpEdit by multiple columns

$
0
0

To filter a LookUpEdit by multiple columns, create a LookUpEditStrategy descendant and override the UpdateDisplayFilter method where the filter criteria is set.

Question Comments

Added By: John Kerin at: 1/14/2015 11:53:57 AM    

Hi, I have downloaded the example for 14.2.3 and it fails to run as it throws an exception:
Unable to cast object of type 'EditorsDataProxy2' to type 'EditorsDataProxy1'.

However, if I run it using earlier versions it runs with no problem.  

Can you let me know a workaround, as I have just upgraded our project from 14.1.4 to 14.2.3 and this use case is blocking me.

Regards,
JK

Added By: Elliot (DevExpress Support) at: 1/15/2015 2:54:33 AM    Hello,


To process your recent post more efficiently, this issue will be processed in the Example to filter a LookUpEdit by multiple columns not working in 14.2.3 ticket. 


Thanks,
Elliot

How to use an external ASPxFilterControl to filter XtraReport

$
0
0

This example illustrates how you can use ASPxFilterControl to apply filter to XtraReport

How to access an API of underlying controls in the WinForms Viewer

$
0
0

The following example demonstrates how to customize controls used to visualize data within dashboard items at runtime using DashboardViewer's API.
In this example, the following options are changed:
- The font of data rows' text is changed in the underlying grid control in the DashboardItemControlUpdated event handler.
- The background color of the chart's pane is changed in the DashboardItemControlUpdated event handler.
- Values of data cells in the underlying pivot grid control are customized using the CustomCellValue event. Subscription and unsubscription to/from the CustomCellValue event are performed in the DashboardItemControlCreated and DashboardItemBeforeControlDisposed event handlers respectively.

How to: Load vector data from Shapefile

$
0
0
This example demonstrates how to load vector data from Shapefile.

How to implement an external filter for the ASPxGridView (ASPxGridView binds via its callback)

$
0
0

UPDATED:

Starting with version 14.2, GridView provides the built-in Search / Find Panel functionality with the capability to locate it outside grid boundaries. This allows accomplishing a similar task with less effort and does not require so much extra code. See the ASP.NET Data Grid: Enhancements post to learn more about this new functionality.

The example demonstrates how to implement an external filter for the ASPxGridView control. To accomplish this, handle the ASPxGridView.DataBinding event and specify a value of the ASPxGridView.FilterExpression property by using the BinaryOperator/GroupOperator types based on values of external editors. To rebind the grid, we perform a callback via the ASPxClientGridView.PerformCallback method.

See also:
How to implement an external filter for the ASPxGridView (ASPxGridView binds via postback)
How to filter ASPxGridView bound to SqlDataSource by using an external ASPxComboBox in Template

How to implement an external filter for the ASPxGridView (ASPxGridView binds via postback)

$
0
0

UPDATED:

Starting with version 14.2, GridView provides the built-in Search / Find Panel functionality with the capability to locate it outside grid boundaries. This allows accomplishing a similar task with less effort and does not require so much extra code. See the ASP.NET Data Grid: Enhancements post to learn more about this new functionality.

The example demonstrates how to implement an external filter for the ASPxGridView control. To accomplish this, handle the ASPxGridView.DataBinding event and specify a value of the ASPxGridView.FilterExpression property by using the BinaryOperator / GroupOperator types based on external editors values.

See also: How to implement an external filter for the ASPxGridView (ASPxGridView binds via its callback)

Question Comments

Added By: José Luis Terán at: 4/9/2013 2:12:48 PM    

I try this sample and fail at the C# code DataBinding procedure, Datasource assignment of a SQLdataSource a I don't use asscess. The error read Data properties on data control 'ASPxGridView1' such as DataSource cannot be changed during the databinding phase of the control.


OBSOLETE - ASPxGridView - creating external filter with the ASPxTextBox and highlighting search text

$
0
0

UPDATED:

Starting with version 14.2, GridView provides the built-in Search / Find Panel functionality with the capability to locate it outside grid boundaries. This allows accomplishing a similar task with less effort and does not require so much extra code. See the ASP.NET Data Grid: Enhancements post to learn more about this new functionality.

The DevExpress ASP.NET controls collection provides a valuable control that allows creating filter expressions - ASPxFilterControl. This control is irreplaceable for advanced users who require to have a tool with rich functionality.
However, this control may be hard to understand for beginners, and they may require a traditional search textbox with the submit button.
This example illustrates how to use this textbox for grid filtering.

See also:
E4029: ASPxTreeList - How to create an external filter with the ASPxTextBox and highlighting search text

How to implement the "Find" and "Find Next" searching functionality in ASPxGridView

$
0
0

UPDATED:

Starting with version 14.2, GridView provides the built-in Search / Find Panel functionality with the capability to locate it outside grid boundaries. This allows accomplishing a similar task with less effort and does not require so much extra code. See the ASP.NET Data Grid: Enhancements post to learn more about this new functionality.

This example demonstrates how to implement the searching functionality in ASPxGridView.


Note that this approach has some limitations:

- It works only for rows that are currently visible in the GridView. So, it works only for expanded group rows.

- It performs searching only in cell values. So, it will not work for cells with a custom text or for the ComboBox column's TextField values.

- As the String.Contains method is used for search, the search is case-sensitive.

See also:
ASPxGridView - creating external filter with the ASPxTextBox and highlighting search text

OBSOLETE - How to implement Filter Panel for ASPxGridView control as XtraGrid's Find Panel

$
0
0

UPDATED:

Starting with version 14.2, GridView provides the built-in Search / Find Panel functionality with the capability to locate it outside grid boundaries. This allows accomplishing a similar task with less effort and does not require so much extra code. See the ASP.NET Data Grid: Enhancements post to learn more about this new functionality.

It's possible to implement a Filter Panel for the ASPxGridView control in the same manner as the XtraGrid's Find Panel is implemented. The main idea is to create a template, and build and apply the ASPxGridView.FilterExpression expression in the ASPxGridView.CustomCallback event handler.

OBSOLETE - GridView - How to implement an external filter

$
0
0
UPDATED:

Starting with version 14.2, GridView provides the built-in Search / Find Panel functionality with the capability to locate it outside grid boundaries. This allows accomplishing a similar task with less effort and does not require so much extra code. See the ASP.NET Data Grid: Enhancements post to learn more about this new functionality.

This solution is based on the T135656: GridView - How to highlight / select rows according to search criteria implementation:
Use MVCxGridView.FilterExpression instead of the MVCxGridView.Selection API in order to filter data records according to the specified criteria.

GridView - How to highlight / select rows according to search criteria

$
0
0
UPDATED:

Starting with version 14.2, GridView provides the built-in Search / Find Panel functionality with the capability to locate it outside grid boundaries. This allows accomplishing a similar task with less effort and does not require so much extra code. See the ASP.NET Data Grid: Enhancements post to learn more about this new functionality.

This example illustrates how to highlight/select rows according to search criteria via a custom MVC GridView callback.

- Define an external filter editor (for example, the ButtonEdit with a single button);
- Handle the client-side ASPxClientButtonEdit.ButtonClick event;
- Perform a custom GridView callback via the client-side ASPxClientGridView.PerformCallback method;
- Pass the editor's value as a parameter;
- 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;
- Pass the retrieved value to the GridView's PartialView via the ViewData key;
- Handle the GridViewSettings.BeforeGetCallbackResult event: if the ViewData key exists, iterate trough GridView rows and select the required one via the MVCxGridView.Selection API.

WinForms SpreadsheetControl API - Part 2

$
0
0

This example is the second part of the SpreadsheetControl API set of examples that demonstrates how to use the SpreadsheetControl API to programmatically manage spreadsheet documents, without the need for Microsoft Excel to be installed.

This sample introduces API properties and methods used to perform the following operations:

- Insert, delete and modify pictures
- Add a hyperlink to a picture
- Add custom functions to the spreadsheet

Starting from v2013 vol.2:
- Create a table
- Apply a custom style to the table

Starting from v2014 vol.1:
- Protect a workbook
- Protect a worksheet
- Apply user-specific permissions to a range in a protected worksheet
- Sort a range in descending and ascending orders
- Sort using a custom comparer
- Sort by multiple columns
- Simple search
- Search with options
- Export to HTML

Starting from v2014 vol.2:
- Group and outline data
- Insert subtotals
- Filter the data by a list of values
- Apply a number filter
- Apply a text filter
- Apply a dynamic filter
- Sort the filtered data
- Specify the built-in document properties
- Specify the custom document properties

How to customize PDF Viewer Ribbon

$
0
0

The following example shows how to customize PDF Viewer Ribbon.

To accomplish this task, it is necessary to override the default PdfViewerControl's RibbonTemplate and add the required bar items to the newly defined RibbonControl.

Updated

Starting with version 14.1.5, you can use actions instead of modifying the template to customize the PdfViewerControl's Ribbon.

Question Comments

Added By: Daniel FS at: 1/15/2015 9:12:39 AM    

Hi,

It seems that in this example you are adding a custom button (MainWindow.xaml.vb):

Private Sub bCustomItem_ItemClick(ByVal sender As Object, ByVal e As DevExpress.Xpf.Bars.ItemClickEventArgs)
           Dim w As New WinUIDialogWindow()
           w.Content = "Hello world!"
           w.ShowDialogWindow(MessageBoxButton.YesNo)
End Sub

But I can't see how it is declared (in MainWindow.xaml it doesn't appear).
How can I add a custom button?
Thanks.

Daniel.


How to manage users (register a new user, restore a password, etc.) from the logon form

$
0
0

Scenario
This example contains a reusable Security.Extensions module that provides a solution for the following suggestions:

Security - provide the capability to register a new user from the logon form
Security.Authentication - provide a "Forgot Password" feature

Refer to the following video to see the module features in action: http://www.screencast.com/t/h2goGEdZJc

Steps to implement

In order to use this module in your project, do the following:

1. Include the module sources into your solution and rebuild it;

2. Invoke the Module Designer for your platform-agnostic module and drag and drop the SecurityExtensionsModule from the Toolbox;

3. Add the following code into your platform-agnostic module class:

[C#]
staticYourPlatformAgnosticModuleName(){SecurityExtensionsModule.CreateSecuritySystemUser=Updater.CreateUser;}

where 'Updater.CreateUser' is your custom method that matches the following definition:

[C#]
publicdelegateIAuthenticationStandardUserCreateSecuritySystemUser(IObjectSpaceobjectSpace,stringuserName,stringemail,stringpassword,boolisAdministrator);

 

IMPORTANT NOTE
This module is currently ASP.NET only.

Question Comments

Added By: Daniele Bonetti at: 8/27/2012 3:14:19 PM    

downloaded and run the demo but i receive "Object reference not set to an instance of an object" error
xaf 12.1.5

Added By: octavia at: 9/24/2012 12:03:14 AM    

It can't be run. Object reference not set to an instance of an object" error

Added By: Santiago Moscoso at: 11/12/2012 3:39:21 PM    

On windows needs to invoke "EnsureShowViewStrategy" method from application, it's protected so you must use reflection.

On web I have problems with the action buttons not refreshing properly, must presh F5 to update buttons. (I'm working on 11.2.11)

Added By: Evgeniy Meyke at: 11/26/2012 4:59:41 AM    

Dennis, any chance to have this checked out soon?

   //Dennis: TODO
            //A possible issue in the framework - Controllers from ShowViewParameters are not added to the current Frame on the Web.
            //e.ShowViewParameters.Controllers.Add(CreateDialogController());

Added By: drew.. at: 3/9/2013 1:16:29 PM    

quick question before i begin integrating this: referring to the comment above " Include the module sources into your solution and rebuild it;" .. are you referring to the modules as listed below, or ALL the xaf modules?

Added By: drew.. at: 3/11/2013 10:12:45 AM    

.. for the benefit of others, this reference to "module" in #1 above, means to drop the entire Security.Extensions folder from the demo into your current solution that you want to update with the basic feature. Then add a reference from your platform-agnostic module (PAM) to the added project, rebuild, THEN go into the module designer for the PAM and drag-n-drop your newly added security module into the required modules section. Then rebuild again.

Added By: drew.. at: 3/11/2013 10:31:40 AM    

btw, i am in the process of integrating this with my DC-only based project. Once i have all the conversions done and tested i will likely post the project to help others save time.

Added By: Mario Blatarić at: 3/12/2013 1:59:10 AM    

Which parts make this module ASP.NET only? I don't understand what needs to be changed in order to make this work in WinForms as well. Any hints?

Added By: John01 at: 4/16/2013 8:10:38 AM    

Hi

When I run the example and click OK on register user I get the error 'Property 'Email' does not exist within type 'DevExpress.ExpressApp.Security.Strategy.SecuritySystemUser'.' on line user.SetMemberValue("Email", email) in function CreateUser. The email value is 'sam@example.com'. I did upgrade the project to 12.2.7 before running though. Any ideas?

Thanks

Regards

Added By: CArlos segura_1 at: 6/13/2013 1:22:53 PM    

someone has been to implement this?

Added By: Tony Tadros at: 9/5/2013 11:51:37 PM    

Hello Devexpress ,

having problem for some time downloading your examples
was thinking something wrong with my pc but tried some other still the same thing

ICAP Error (icap_error)

  
 An error occurred while performing an ICAP operation: Maximum file size exceeded; File: GetExample; Sub File: ManageUsersOnLogon.Module\BusinessObjects\ReadMe.txt; Vendor: Kaspersky Labs; Engine error code: 0x00000000; Engine version: 8.1.8.79; Pattern version: 130905.225000.10967985; Pattern date: 2013.09.05 22:50:00
 There could be a network problem, the ICAP service may be misconfigured, or the ICAP server may have reported an error.

 For assistance, contact your network support team.

Added By: Apostolis Bekiaris (DevExpress) at: 9/19/2013 3:35:30 AM    

Implemented in eXpandFramework 13.1.7.1
http://apobekiaris.blogspot.gr/2013/09/how-to-manage-users-register-new-user.html

How to access API of underlying widgets in the Web Viewer

$
0
0

This example demonstrates how to customize client widgets used to visualize data within dashboard items at runtime using ASPxClientDashboardViewer's API.
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 ItemWidgetCreated and ItemBeforeWidgetDisposed event handlers respectively.
- A pie legend is shown for the underlying dxPieChart.

How to access API of underlying widgets in the MVC Viewer

$
0
0
This example demonstrates how to customize client widgets used to visualize data within dashboard items at runtime using ASPxClientDashboardViewer's API.
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 ItemWidgetCreated and ItemBeforeWidgetDisposed event handlers respectively.
- A pie legend is shown for the underlying dxPieChart.

How to manually add MapBubble items to the map

$
0
0
The following example illustrates how to manually add an array of MapBubble objects to the Map control.
Question Comments

Added By: Zex Marshal at: 1/16/2015 4:53:44 AM    

how to transparency bubble color

Added By: Maxim (DevExpress Support) at: 1/16/2015 6:44:23 AM    

Hello Zex,

I have created a separate thread for us to discuss this issue in the most efficient manner.
How to make transparent bubbles
There you will find a video illustrating how to change this project and have transparent bubbles. Please refer to it and feel free to contact me if you have questions.

How to use XtraSpellChecker in XAF

$
0
0

Scenario
This example demonstrates how to incorporate the XtraSpellChecker to XAF applications.

Steps to implement
1. Copy the Spelling.Win project into your solution and build it;

2. Invoke the Application Designer for your executable WinForms project (YourSolutionName.Win) or the Module Designer for your WinForms module project (YourSolutionName.Module.Win) and open the Toolbox (Control+Alt+X);
3. Drag the SpellingWindowsFormsModule item from the Toolbox;
4. Build and run your project.


IMPORTANT NOTES:
If you are using RichEditControl, check out the Adding Richedit to Sample E736 thread for additional configuration.

Question Comments

Added By: Dennis (DevExpress Support) at: 6/1/2012 7:17:15 AM    

See also:
Q405371

Added By: Louis Z at: 5/15/2014 8:04:47 AM    

1. Copy the Spelling.Win project into your solution and build it;
2. Invoke the Application Designer for your executable project and open the Toolbox (Control+Alt+X);
3. Drag the SpellingWindowsFormsModule item from the Toolbox;
4. Build and run your project.

Added By: Tony Tadros at: 1/15/2015 9:53:11 AM    

Hello Devexpress ,this example is not working anymore ,do you have any update

Added By: Dennis (DevExpress Support) at: 1/16/2015 8:27:34 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T197752: SpellChecker integration in XAF 14.2. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.



Viewing all 7205 articles
Browse latest View live


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