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

How to use custom cell editors to create a data entry form

$
0
0
This example demonstrates how to use custom cell editors to create a data entry form that allows end-users to quickly generate invoices. The required data entry fields are marked with an asterisk. To add a new record to the invoice or delete the existing one, an end-user should switch to the Invoice tab and click the Add or Remove button, respectively. All other content is protected to prevent inappropriate modifications.

Data for the invoice is provided based on the document template (DevAVInvoicing.xltx), which includes the following worksheets:
• Invoice – contains a sales entry form;
• Customers (hidden) – contains customer info;
• Employees (hidden) – contains a list of employees;
• Products (hidden) – contains product data;
• Stores (hidden) – contains information about stores owned by customers.

To retrieve the required data from worksheets, the Spreadsheet uses the VLOOKUP and DGET functions. For example, when an end-user selects a customer's name in the Billing Address section, VLOOKUP is used to find and display the customer's billing address. In the same way, the DGET function is used to automatically display the shipping address based on the customer's name and the selected city of the store to which the order should be delivered.

How to convert and then print GridControl by using XtraReport

$
0
0

This example demonstrates how to dynamically create a report based on the GridControl at runtime. This means that all filtering, sorting and grouping conditions selected in the grid are also applied in the report. To accomplish this task, it is necessary to create a report with all the necessary bands, bind it to a data source, and adjust all the necessary options. You can use this approach if you need to insert a report based on GridControl into another report.

[Update]
Starting with version 15.2, you can use GridReportManagerService to convert and export GridControl by using XtraReports.

Question Comments

Added By: Goce Sapkar at: 7/19/2013 4:58:08 AM    

Great example. It helped me a lot.

What if we have master-detail relationship in the GridControl. How could i print them in this report ?

<dxg:GridControl.DetailDescriptor>
                <dxg:DataControlDetailDescriptor x:Name="gridDetailDescriptor" ItemsSourceBinding="{Binding SampleBinding}" ShowHeader="false">
                    <dxg:GridControl x:Name="detailGrid" AutoPopulateColumns="True">
                        <dxg:GridControl.View>
                            <dxg:TableView AutoWidth="True" NavigationStyle="Row" ShowTotalSummary="True" AllowEditing="False" S ShowGroupPanel="False" />
                        </dxg:GridControl.View>
                    </dxg:GridControl>
                </dxg:DataControlDetailDescriptor>
</dxg:GridControl.DetailDescriptor>

Added By: Murad BASDAG at: 9/10/2015 3:35:56 PM    

Hello,

Can we use below helper in our application freely (we have DXperience license). If we cannot please inform us as soon as possible.

B.R.
Murad BAŞDAĞ

Added By: Elliot (DevExpress Support) at: 9/11/2015 5:14:20 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T288902: Can we use the ReportHelper from E4658 in our application freely?. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to handle GridControl's events by using the EventToCommand extension

$
0
0

MVVM Framework provides the EventToCommand class that allows delegating event processing logic to the ViewModel level. This example illustrates how to use this functionality to process DXGrid events.

The EventToCommand class provides the PassEventArgsToCommand option that allows passing the corresponding EventArgs as a command parameter. If necessary, you can extract the required information from event arguments and then pass this information as a command parameter. To do this, use the EventArgsConverter.

How to make the auto filter row's filter accent insensitive

$
0
0

This example demonstrates how to create a custom function that removes all diacritic symbols from the specified string value. Using the GridView.SubstituteFilter event, this function can be injected into the active grid filter.

The SubstituteFilter event was added in version 2015 vol 1. To accomplish this task in older version, create a custom grid and customize the mechanism of filtering data via the auto filter row. For this, the GridView.RaiseCustomRowFilter method can be overridden. In this method, the cell text and filter string should be normalized via the standard String.Normalize method and then the cell value is processed based on the comparison operator type returned via the OptionsColumnFilter.AutoFilterCondition property.

Question Comments

Added By: Martin Šváha at: 8/26/2016 2:33:32 AM    Dear DevExpress support.
I have used SubstituteFilter event for accent insensitive GridView in GridLookupEdit.
There is a problem and I can't find solution for typing with accent insensitive.
Filtering is ok.

For example, I have cities like this:

Kosiny
Kosonohy
Košice
Košice - západ

When I filter Kosi, then control filters cities:

Kosiny
Košice
Košice - západ

This is ok, but I can´t type into filter row Kosic, only Kosin.

How can I allow to disable accent in typing into filter row?

Thanks for any idea
Martin


Added By: Stas (DevExpress Support) at: 8/26/2016 7:24:49 AM    

Hello,

I've created a separate ticket on your behalf (How to disable accent in typing into a filter row in the E5021 example). It has been placed in our processing queue and will be answered shortly.

GridView - How to implement cascaded combo boxes in the EditForm

$
0
0

This example is an illustration of the KA18675: MVC ComboBox Extension - How to implement cascaded combo boxes KB Article. Refer to the Article for an explanation.

Question Comments

Added By: Cankut at: 8/26/2016 7:03:22 AM    Thanks for this great demonstration , i've used this in my project, could you upgrade this by using three cascaded combo boxes like Country, City and Street in MVC?Added By: Artem (DevExpress Support) at: 8/26/2016 8:13:07 AM    Hi,

You're welcome! I see you've asked the same question in the Cascade three thread. We'll reply to you there as soon as possible. Please refer to it for further correspondence.

How to show an error message when a record cannot be deleted

$
0
0

This example demonstrates how to show an error message when an attempt to delete a record is cancelled by the RowDeleting event handler.

Question Comments

Added By: Rabab Siblini at: 3/16/2016 11:18:39 PM    Tanks, it works exactly as I want , but I didn't user the exception class , I check it as such :

 protected void gvDiscounts_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)        {            if (CannotDelete)                throw new Exception("DeleteError");        }

  protected void gvDiscounts_CustomErrorText(object sender, ASPxGridViewCustomErrorTextEventArgs e)        {            if (e.Exception.Message == "DeleteError")                e.ErrorText = e.Exception.Message;        } Added By: Vova (DevExpress Support) at: 3/17/2016 1:57:07 AM    

Thank you for sharing your idea with our community, Rabab. It may be useful for other users trying to complete a similar task.

Best regards,
Vova

Added By: Jay Johnson at: 3/24/2016 6:05:38 PM    This was very nice to find!Added By: Hal Burch at: 8/26/2016 7:21:11 AM    This example doesn't work when I download it and run it in VS. I get the MyException was unhandled by user code.Added By: Helen (DevExpress Support) at: 8/26/2016 8:28:11 AM    

Hello Hal, 


This example illustrates how to handle errors that occurs on row deletion. In this example, the "MyException" is thrown there intentionally to emulate an exception on deletion. If you choose to continue code execution after the exception, it will show the custom error text specified in the ASPxGridView.CustomErrorText event handler as expected.

How to customize copy and paste commands

$
0
0

This example illustrates how to override CopySelectionCommand and PasteSelectionCommand behavior via the IRichEditCommandFactoryService substitution. This approach is based on the How to replace standard XtraRichEdit command with your own custom command example.

Customized CopySelectionCommand contains code for copying selection to the Clipboard in an HTML Clipboard Format (see the HtmlHelper.GetHtmlClipboardFormat() method), which is not implemented by default at the XtraRichEdit source code level. This allows you to copy RichEditControl content and paste it directly to a certain control that can accept HTML-formatted data from the clipboard (e. g. ASPxHtmlEditor). Note that images are embedded into resultant HTML according to the Data URI scheme specification to avoid dependency on the image location (it may not be resolved by the target application). Refer to the Building a mail application with the RichEditControl example to learn more on this approach.

As for customized PasteSelectionCommand, it simply retrieves plain (unformatted) text from the clipboard and pastes this text into the RichEditControl.

See Also:
SubDocument.GetText Method
SubDocument.GetRtfText Method
SubDocument.GetHtmlText Method

Question Comments

Added By: Andrew R Miller at: 1/13/2014 1:47:49 PM    

Thank you! Worked great! I was looking for a way to strip the formatting before pasting in a RichEditControl.

Added By: nbabu at: 8/26/2016 3:06:36 PM    When the Paste command is executed, i want to pass the pasted text's range back to the form where i have rich edit control.
I know how to get the range from cursor positions before and after paste, but how do i pass it back to the form?

How to use custom dock hints and the dock zone in the DockManager

$
0
0

It's necessary to respecify templates corresponding to the defined resource keys. The dock zone and dock hint elements are placed in the DockVisualizerThemeKey. The resource keys for the dock zone and the left dock hint are DockZone and Left keys respectively. These are the keys you should respecify:

<ControlTemplate x:Key="{dxt:DockVisualizerThemeKey ResourceKey=Left}">
<ControlTemplate x:Key="{dxt:DockVisualizerThemeKey ResourceKey=DockZone}">


GridView - How to use Callback Mode for the ComboBox column

$
0
0

UPDATED:

Starting with version v2016 vol 1 (v16.1), a built-in combo box editor can operate in callback mode.  You can find detailed steps by clicking the "Show Implementation Details" link below.


For earlier versions:
At this moment, GridView does not support Callback Mode for the built-in combobox editor in ComboBoxDataColumn: GridView - Support callback mode for the built-in editor of the MVCxGridViewColumnType.ComboBox column. However, in some scenarios it is required to use ComboBoxDataColumn in Callback Mode, for instance, when the ComboBox' data source is too large. In this case it is necessary to use templates. This example demonstrates how to implement Callback Mode ComboBox in Edit Form and in Auto Filter Row of the GridView.
See also:
Using Callbacks

How to provide the quick search functionality for PivotExcelFieldListControl (Customization Form with FieldListStyle="Excel2007")

$
0
0

This example illustrates how to add a search box to the field list control. 
Our PivotExcelFieldListControl uses the TreeViewFieldsPresenter component to show fields in a tree-like view. In this example, we create a TreeViewFieldsPresenter control descendant and implement the filtering functionality at its level.  The default TreeViewFieldsPresenter is replaced with our descendant via styles.

Important: The provided approach works when fields are grouped via User Folders. In OLAP mode, fields are grouped automatically. If fields are not grouped, PivotGrid uses another control (not TreeViewFieldsPresenter ) to manage hidden fields and custom style is not used.

Question Comments

Added By: Constant (DevExpress Support) at: 10/9/2015 2:42:04 AM    This solution works for the grouped field list. In the OLAP mode, fields are grouped in the customization form by default. In the traditional binding mode, it is possible to group fields manually by specifying the PivotGridField.DisplayFolder Property for all or just some of them. This solution also helps to simplify layout customization if a lot of fields are available. Added By: Angshuman Agarwal 1 at: 8/29/2016 11:01:27 AM    Hi,
Getting error while running this sample in 15.1.8

[C#]
Anexceptionoftype'DevExpress.XtraPivotGrid.Data.OLAPConnectionException' occurredinDevExpress.PivotGrid.v15.1.Core.dllbutwasnothandledinusercodeAdditionalinformation:Couldn'tconnecttotheAnalysisServices.

Can someone please look into this ?

regards
Angshuman
Added By: Alex (DevExpress Support) at: 8/30/2016 12:00:19 AM    

Hi Angshuman,

I have tested the example using v15.1 assemblies, and the OLAP server specified using the OlapConnectionString property works without errors. If you are using a different OLAP data source, check to see that the provided connection string is valid.

How to display bookmark names in the Bookmarks pane of PDF Viewer for a document exported to PDF

$
0
0
This example demonstrates how to create a service that implements the DevExpress.XtraRichEdit.Services.ILinkUpdater interface to change titles used to display document bookmarks in the Bookmarks pane of PDF Viewer after a document is exported to PDF. 
By default, when the BookmarkOptions.DisplayBookmarksInPdfNavigationPane property is set to All or TocBookmarks, the Bookmarks pane displays not a name of a bookmark but the first 512 symbols of text to which the bookmark is assigned. To change this default behavior and display bookmark names in the Bookmarks pane, implement the ResolveBookmarkTitle method of the ILinkUpdater interface.

How to implement setting custom margins in ASPxSpreadsheet

$
0
0

This code example demonstrates how to implement setting custom margins in the ASPxSpreadSheet.

To test the functionality, choose menu item Margins - Custom Margins, set preferable values and open a document preview using File - Print menu.

UPDATED:
Starting with v15.2, the new Page Setup dialog was introduced, providing a set of print-related options (document orientation, paper size, page order, etc.) and making it possible to set custom page margins (Specify Print Options). See this in action in our Spreadsheet - Printing online demo.

How to configure dxDataGrid with Angular Approach

$
0
0

This example demonstrates how to display data from a data source in dxDataGrid created using the AngularJS approach.

See also:
Configure Widget - Angular Approach

Question Comments

Added By: Marion (DevExpress Support) at: 8/12/2014 6:21:57 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T139489: How to configure dxDataGrid with Angular approach and handle the optionChanged event. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Scott Wood at: 8/27/2014 6:12:41 AM    

The demo code is incomplete.  dataSource:employees...   Where does employees come from?  I assume it's just a plain old javascript array????

Added By: Marion (DevExpress Support) at: 8/27/2014 10:53:50 PM    @Scott,
Please download the example locally to see all project files including the data.js file that contains the employees data. Added By: Will Meister at: 10/12/2014 9:39:05 AM    

Could you please dive a little deeper into this example? For instance, does listing 'employees' as the dataSource provide two-way databinding, or would 'dataSource' need to be listed in one of the bindingOptions? Also, could you provide a functioning example of configuring the rowUpdated, rowUpdating, rowRemoved, and rowRemoving event handlers? In my project, none of them get triggered, though rowClick works properly.

Thanks!,
Will

Added By: Marion (DevExpress Support) at: 10/12/2014 11:48:42 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T160337: How to configure dxDataGrid CRUD operations with Angular Approach. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Jack Parna at: 2/23/2016 11:23:10 PM    how about in mobile view?
I have tried, but it not working. Added By: Nikolai (DevExpress Support) at: 2/24/2016 7:11:33 AM    

Hello Jack,

To process your post more efficiently, I created a separate ticket on your behalf: T349388: How to configure dxDataGrid with Angular Approach in a mobile app. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Surya Garimella at: 8/30/2016 7:48:14 AM    Hello,

do you have a similar example with the latest version of angular ? 1.5.9 ?

Thanks. Added By: Marion (DevExpress Support) at: 8/30/2016 11:51:49 PM    @Surya,
Code is the same for Angular 1.5.9. If you encountered any issue with this, please open a new thread and provide us with your code there. We will research it and do our best to find a solution for you.

ASPxGridView - Batch Editing - A simple implementation of an EditItemTemplate

$
0
0

This example demonstrates how to create a custom editor inside a column's EdittemTemplate when ASPxGridView is in Batch Edit mode. Since ASPxGridView performs batch editing on the client side, we cannot process or pass values from editors placed inside templates on the server side. Thus, all processing will be performed on the client side. 


You can implement the EditItem template for a column by performing the following steps:

1. Specify a column's EditItemTemplate:

[ASPx]
<dx:GridViewDataColumnFieldName="C1"><EditItemTemplate>   <dx:ASPxSpinEditID="C1_spinEdit"runat="server"ClientInstanceName="C1spinEdit"Width="100%">   </dx:ASPxSpinEdit></EditItemTemplate></dx:GridViewDataColumn>

 

2. Handle the grid's client-side BatchEditStartEditing event to set the grid's cell values to the editor. It is possible to get the focused cell value using the e.rowValues property:

[JavaScript]
       function Grid_BatchEditStartEditing(s, e){           var templateColumn = s.GetColumnByField("C1");           if(!e.rowValues.hasOwnProperty(templateColumn.index))               return;           var cellInfo = e.rowValues[templateColumn.index];            C1spinEdit.SetValue(cellInfo.value);           if(e.focusedColumn === templateColumn)                C1spinEdit.SetFocus();       }

 

3. Handle the BatchEditEndEditing event to pass a value entered in the editor to the grid's cell:

[JavaScript]
function Grid_BatchEditEndEditing(s, e){           var templateColumn = s.GetColumnByField("C1");           if(!e.rowValues.hasOwnProperty(templateColumn.index))               return;           var cellInfo = e.rowValues[templateColumn.index];            cellInfo.value = C1spinEdit.GetValue();            cellInfo.text = C1spinEdit.GetText();            C1spinEdit.SetValue(null);       }

 

4. The BatchEditRowValidating event allows validating the grid's cell based on the entered value:

[JavaScript]
function Grid_BatchEditRowValidating(s, e){           var templateColumn = s.GetColumnByField("C1");           var cellValidationInfo = e.validationInfo[templateColumn.index];           if(!cellValidationInfo)return;           var value = cellValidationInfo.value;           if(!ASPxClientUtils.IsExists(value) || ASPxClientUtils.Trim(value) === ""){                cellValidationInfo.isValid = false;                cellValidationInfo.errorText = "C1 is required";           }       }

 

5. Finally, handle the editor's client-side KeyDown and LostFocus events to emulate the behavior of standard grid editors when an end-user uses a keyboard or mouse:

[JavaScript]
var preventEndEditOnLostFocus = false;function C1spinEdit_KeyDown(s, e){           var keyCode = ASPxClientUtils.GetKeyCode(e.htmlEvent);           if(keyCode === ASPx.Key.Esc){               var cellInfo = grid.batchEditApi.GetEditCellInfo();                window.setTimeout(function(){                    grid.SetFocusedCell(cellInfo.rowVisibleIndex, cellInfo.column.index);               }, 0);                s.GetInputElement().blur();               return;           }           if(keyCode !== ASPx.Key.Tab && keyCode !== ASPx.Key.Enter)return;           var moveActionName = e.htmlEvent.shiftKey ? "MoveFocusBackward" : "MoveFocusForward";           if(grid.batchEditApi[moveActionName]()){                ASPxClientUtils.PreventEventAndBubble(e.htmlEvent);                preventEndEditOnLostFocus = true;           }       }function C1spinEdit_LostFocus(s, e){if(!preventEndEditOnLostFocus) grid.batchEditApi.EndEdit(); preventEndEditOnLostFocus = false;}

 

See Also:
GridView - Batch Editing - A simple implementation of an EditItem template 

How to populate a List View with data from a LINQ query

$
0
0

NOTE: Starting from version 16.1, a simpler solution can be implemented based on the How to: Display a Non-Persistent Object's List View from the Navigation article, using a non-persistent object to represent the query result set.

Scenario

Sometimes it is important to show a readonly ListView with custom data obtained from the database, rather than through standard XPO mechanisms, by means of loading entire persistent objects.

While this custom data may include certain properties of your XPO classes, in a general case, it may come from anywhere, including but not limited to, a raw SQL query, stored procedure, database view or a very complex LINQ query returning only a subset of persistent class properties or even custom data fields. While the first scenarios can be solved by mapping a persistent class to a database view, the second group of scenarios is optimal in implementing a custom form/control (check How to show custom forms and controls in XAF (Example) for more details) or a custom CollectionSource.
Here, we will demonstrate how the latter option can be realized to display data from a custom LINQ query using the LINQ to XPO approach.

In particular, we want to show a list of employees with maximum orders:


Steps to implement

1. Include the XAF.LinqToXpo module project in your solution and make sure it builds successfully.

This module is supposed to generate custom ListView nodes in the Application Model with the _Linq suffix so that this ListView uses data returned by a predefined method (see the XPQueryMethod attribute for the ListView node) using LINQ.

To provide this custom ListView with data, a custom CollectionSourceBase class descendant is implemented (see the XAF.LinqToXpo\LinqCollectionSource.xx file). It is enabled for a custom ListView via the XafApplication.CreateCustomCollectionSource event (see the XAF.LinqToXpo\Module.xx file).


2. Invoke the Module Designer for YourSolutionName.Module project and drag and drop the XafLinqToXpoModule component to the Required Modules list (this component should automatically appear in the Visual Studio Toolbox after executing the previous step).


3. Implement the public static methods that accept DevExpress.Xpo.Session as a parameter and return System.Linq.IQueryable as a result in your persistent classes, where required.

Consider the following signature for more clarity: public static System.Linq.IQueryable MethodName(DevExpress.Xpo.Session session);

Within the method body, use the LINQ to XPO approach to return a required data set based on XPQuery<T>. If you want to return a custom property as part of your data set which does not exist within your XPO data model, then include it into the selected part of the query with a custom name (e.g., Employee_Linq, Orders_Sum_Linq, etc.).

Mark these methods with the XAF.LinqToXpo.QueryProjectionsAttribute to specify that comma-separated names of data properties will be included as a query result.

Refer to the NorthwindDemo.Module\PersistentObjects.xx for an example.


4. Invoke the Model Editor for YourSolutionName.Module project and add custom calculated fields with dummy expressions for each specified custom property which is not part of your default XPO data model. Refer to the NorthwindDemo.Module\Model.DesignedDiffs.xafml file for an example.


IMPORTANT NOTES

1. This example uses the Northwind database for testing. You can download the database creation scripts for testing from here.

2. Since a Linq-based ListView may contain custom data sets and not entire persistent objects in a general case, certain standard Controllers are disabled here (e.g., you cannot open a detail form for this data record or create a new object). Refer to the XAF.LinqToXpo\DisableStandardActionsLinqListViewController.xx file for more details.

3. If you want your default ListView to include custom calculated values, then it is possible to use the built-in Custom Fields feature for that purpose.

Question Comments

Added By: Artem G. at: 9/25/2015 4:02:41 AM    

Hello Dennis. Sorry, but your code doesn't work in my simple test project.
1. First problem is that I throws an exception like "Unable to cast object of type 'ModelListView' to type 'XAF.LinqToXpo.IModelListViewLinq'."
It happens not on run, but when I open XAF Model Editor in VS. It doesn't like the line:  
   listViewInfo = (IModelListView)node.AddNode<IModelListView>(id);
in class  ModelListViewLinqNodesGeneratorUpdater.
If I comment it, Editor works fine.

2. While I have created the entities in business object folder of Model  like Customer, Employee, Orders, they have appeared in views (as any other business object), but If I try to set my custom created view with _Linq suffix to nodes, it doesn't want to work, doesn't load objects (Customer). Maybe it's a  the default behaviour works, not your code? Otherwise it even doesnt enter the most part of code in ModelListViewLinqColumnsNodesGeneratorUpdater because it doesn't find any XPQueryMethod method (XPQueryMethod == null)

3. Somehow only view with name Customer_ListView_CustomersLInq_Linq  appears in Model Editor. Others don't. Maybe because of problem from (1). I set it to my node, but it didn't load data (problem 2)

4. I'm not sure that it's a real important to get data from linq, but it's much more important for all community to show one good example with stored procedures and link this post no more. All link  from forum references this article. But I doesn't clarify how can I use SP and where. Could you pls provide an example project with SP. Or at least a working project with this code

Regards, Artem

Added By: Artem G. at: 9/25/2015 4:03:35 AM    

I used last version of code. My XAF version is 13.2.10 (can't and woudn't upgrade, becase of project convert problems)

Added By: Artem G. at: 9/25/2015 4:28:47 AM    

And also such behaviour like "you cannot open a detail form for this data record " is very-very bad. Are there any solutions?
I just exmplane a simple use-case, where it's required:
1. You need a user audit statistics to be show like  "department",  "action", "total users", "total visits"
2. All these "totals" have to be calculated on DB level with stored procedure. So I need all this workaround to be used.
3. On details click I want to see the full statistics about department: exact list of users and their actions.

So, how can I show details ?

Added By: Dennis (DevExpress Support) at: 9/28/2015 7:07:06 AM    

@Artem:

A1-3: This can happen only if the 2nd step from the instructions above was skipped. Please verify it in your own sample.
A4: This LINQ-based example was originally created based on many community requests. While we will unlikely provide a new example for the old XAF versions, in the latest XAF version we have a new feature and also the eXpressApp Framework > Task-Based Help > How to: Display a Non-Persistent Object's List View from the Navigation and How to: Display Non-Persistent Objects in a Report documentation articles describing how to show non-persistent data coming from anywhere in XAF forms. It can be a stored procedures results or anything you want. 
A5: While the capability to display a corresponding DetailView by double-clicking on a ListView record is not implemented in this particular example, it is not difficult to implement this functionality yourself by handling the eXpressApp Framework > DevExpress.ExpressApp.SystemModule > ListViewProcessCurrentObjectController > CustomProcessSelectedItem event.
I hope you find this information helpful. If you have any further difficulties, submit a separate ticket and attach your test project where you tried to implement the suggested changes.

 

Added By: Leo Hui at: 9/29/2015 12:11:55 AM    

in Module.cs...
The name 'InitializeComponent()' does not exist in the current context...
how do I solve that?

Added By: Dennis (DevExpress Support) at: 9/29/2015 12:18:09 AM    

@Leo: It is likely you have not converted your solution using the Project Converter tool. The following StackOverFlow threads describe other possible causes of this compilation error: http://stackoverflow.com/search?q=InitializeComponent%28%29%27+does+not+exist+in+the+current+context.
If this does not help, please submit a separate ticket and attach the project source where you are experiencing this error.


 GridView - How to add a custom button to the FilterPanel

$
0
0

This example demonstrates how to add a button to the FilterPanel.




To use this solution in your application, execute the following steps:

1. Create a custom GridControl as it is shown at How to create a GridView descendant class and register it for design-time use.
2. Implement all required functionality in the CustomGridViewHandler, CustomGridView, CustomGridFilterPanelPainter classes.


Implementation details

In fact, the buttons are not located in the FilterPanel. They are simply drawn on its surface. Therefore, it is necessary to implement the Click (or MouseDown\Up) event manually and trigger it when required in your scenario. In this example, the Click event is raised when a custom button is clicked. If you need, for instance, to raise this event when the mouse button is released, you can simply update the CustomGridView.UpdateButtonState method. For instance, pass a parameter into this method which will indicate whether or not the CustomGridViewHandler.OnMouseUp event occurs. Then use this parameter in order to determine whether or not the Click event should be raised. 

It is also possible to change the distance between custom buttons, as well as their size. For this, update the CustomGridView.UpdateButtonsRects method as your needs dictate.

See also:
How to add a custom button to a column header in a grid 
GridControl - How to add a check box to a column header

ASPxGridView - How to show the number of selected rows in the Pager bar

$
0
0

This example demonstrates how to show the number of selected rows in the Pager bar. It is necessary to create a custom PagerBar template for this purpose. This template will contain ASPxLabel that allows showing the number of selected rows and a standard pager created via the ASPxGridViewTemplateReplacement control:

[ASPx]
<PagerBar><table><tr><td><dx:ASPxGridViewTemplateReplacementrunat="server"ReplacementType="Pager"/></td><td><dx:ASPxLabelID="labelInfo"runat="server"Text=""ClientInstanceName="labelInfo"></dx:ASPxLabel></td></tr></table></PagerBar>

We can get the grid's selected row count via the client-side ASPxClientGridView.GetSelectedRowCount method and then set it to ASPxLabel using the label's SetText method:

[JavaScript]
function ShowRowsCount(){ labelInfo.SetText('Selected rows count: ' + gridView.GetSelectedRowCount());}
Question Comments

Added By: Patrick Saunders at: 8/30/2014 9:14:10 PM    

From here:
http://stackoverflow.com/questions/7808230/devexpress-how-do-get-an-instance-of-a-control-client-side-and-access-its-clien

Make sure to set the clientInstanceName, this caught me out for a while, you will get Javascript referrence errors.

Added By: Sandeep Agarwal 3 at: 8/31/2016 2:01:27 PM    I've the Pager displayed in both top and bottom of the ASPxgridView. But the selection count gets displayed only at the bottom. Is it possible to move it up ?

How to bind a Bound Image dashboard item to data in code

$
0
0

The following example shows how to use a Bound Image dashboard item to display a specified image accessible by a predefined URI.

How to add custom filter items into the DateTime filter popup window

$
0
0

In the latest versions, you can use the ShowFilterPopupDate event to add a custom filter item to the filter dropdown. See the ShowFilterPopupDate topic for additional information and code snippet.


------------------------------------------------------------------------
This example demonstrates how to add the capability to enter "greater than", "less than", and "between" directly from the calendar popup filter list.

To provide this functionality, it is necessary to create a GridControl descendant with a custom MyGridView.

First, override the MyGridView.CreateDateFilterPopup and MyGridView.RaiseFilterPopupDate methods.

[C#]
protectedoverrideDateFilterPopupCreateDateFilterPopup(GridColumncolumn,System.Windows.Forms.ControlownerControl,objectcreator){returnnewMyDateFilterPopup(this,column,ownerControl,creator);}

In the MyGridView.RaiseFilterPopupDate method add required FilterCriteria.

[C#]
protectedoverridevoidRaiseFilterPopupDate(DateFilterPopupfilterPopup,List<FilterDateElement>list){CriteriaOperatorfilter=newBinaryOperator(filterPopup.Column.FieldName,DateTime.Today,BinaryOperatorType.Greater);list.Add(newFilterDateElement(Localizer.Active.GetLocalizedString(StringId.FilterClauseGreater),"",filter));filter=newBinaryOperator(filterPopup.Column.FieldName,DateTime.Today,BinaryOperatorType.Less);list.Add(newFilterDateElement(Localizer.Active.GetLocalizedString(StringId.FilterClauseLess),"",filter));filter=newBetweenOperator(filterPopup.Column.FieldName,DateTime.Today,DateTime.Today);list.Add(newFilterDateElement(Localizer.Active.GetLocalizedString(StringId.FilterClauseBetween),"",filter));base.RaiseFilterPopupDate(filterPopup,list);}

Now, the CreateDateFilterPopup method returns the MyDateFilterPopup object instead of the DateFilterPopup one.

Override the Popup.CreateRepositoryItem method to create additional controls and add handlers for them:

[C#]
protectedoverrideRepositoryItemPopupBaseCreateRepositoryItem(){item=base.CreateRepositoryItem()asRepositoryItemPopupContainerEdit;if(DateFilterControl.Controls.Count> 0){DateCalendar1=CreateCalendar(DateCalendar1,DateCalendar.SelectionStart,DateCalendar.Top,DateCalendar.Left);DateCalendar1.Visible=false;DateCalendar2=CreateCalendar(DateCalendar2,DateCalendar.SelectionStart,DateCalendar1.Top,DateCalendar.Left+DateCalendar1.Width);DateCalendar2.Visible=false;Greater=GetCheckEditByName(Localizer.Active.GetLocalizedString(StringId.FilterClauseGreater));Less=GetCheckEditByName(Localizer.Active.GetLocalizedString(StringId.FilterClauseLess));Between=GetCheckEditByName(Localizer.Active.GetLocalizedString(StringId.FilterClauseBetween));Greater.CheckedChanged+=CheckedChanged;Less.CheckedChanged+=CheckedChanged;Between.CheckedChanged+=CheckedChanged;foreach(ControlctrlinDateFilterControl.Controls){if(ctrlisCheckEdit)if(NotOurControl(ctrlasCheckEdit))(ctrlasCheckEdit).CheckedChanged+=OriginalDateFilterPopup_CheckedChanged;}}returnitem;}

When a custom item's check state changes, update the popup window layout to display the calendar at a required place.

[C#]
voidCheckedChanged(objectsender,EventArgse){if((senderasCheckEdit).Checked){UpdateOurControlCheckedState((senderasCheckEdit).Text);CalcControlsLocation((senderasCheckEdit).Text);this.View.ActiveFilterCriteria=GetFilterCriteriaByControlState();}else{if(DateCalendar1.Visible||DateCalendar2.Visible){ReturnOriginalView();ReturnOriginalControlsLocation();}}}

 

How to change the Grid's height according to the total height of its rows

$
0
0

The size of each GridView's element is calculated by the GridViewInfo class. The instance of the GridViewInfo class, containing information about a specific GridView instance, can be obtained via the GridView.GetViewInfo method. This method is hidden for IntelliSence, but is public and can be called from external code.

Question Comments

Added By: Gerard Chartier at: 6/16/2014 4:40:32 AM    

I am having problems with this approach. When I set gridControl1.Size to the newly calculated value, it has no effect. Is there a property of the GridControl that could prevent it from being resized? My GridControl is within a LayoutControl, along with a number of LayoutControlItems and their controls. I am using version 13.2.9.

Added By: Uriah (DevExpress Support) at: 6/16/2014 5:29:40 AM    Hello Gerard,

I have created a new ticket on your behalf and passed it to our team for research: Setting the GridControl.Size property to a value has no effect if the GridControl is inside the LaoutControl  Please bear with us. We will get back to you as soon as possible.Added By: Jerther at: 12/10/2015 6:57:31 AM    

Is this still the best and only way, now with 15.1?

Added By: Uriah (DevExpress Support) at: 12/11/2015 5:31:57 AM    Hello Jerther,

Yes, this is the best way. We have not yet added another method or property that can be used for the same purpose.Added By: Justin Tysco at: 9/1/2016 2:38:23 PM    CalcRealViewHeight does not seem to calculate the height correctly if I assign a memo edit to one of the columns and have word wrapping & auto height enabled (causing some rows to be taller than others).


Is there any way to calculate the correct height for such a scenario?
Added By: Nadezhda (DevExpress Support) at: 9/1/2016 11:17:14 PM    

Hello,

I've created a separate ticket on your behalf (How to change the GridControl height based on the height of all rows when MemoEdit is used). It has been placed in our processing queue and will be answered shortly.

Viewing all 7205 articles
Browse latest View live


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