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

GridView - How to access/modify FilterExpression on the controller and save/load custom filters

$
0
0
This example illustrates how to pass the ASPxGridView.FilterExpression property value between the Controller, View and client-side parts of an application. In particular, we can store custom filters in a separate ListBox extension.

The main implementation details are:
- Pass the current FilterExpression value to the client side by handling the GridViewSettings.CustomJSProperties event (you can find a similar technique in the E5121 - GridView - How to implement data editing with hidden column code example).
- Pass the required FilterExpression value to the server side by calling the MVCxClientGridView.PerformCallback(Object) method. Alternatively, you can use the approach from the Passing Values to a Controller Action through Callbacks help section (e.g., see T146962 - GridView - How to track ClientLayout with a separate ListBox).
- Put the passed value to the ViewData dictionary to be able to intercept it in the View context and apply filter to GridView by handling the DataBound event.

PopupControl - How to display the control after executing controller code

$
0
0
This example illustrates several approaches to display the PopupControl extension after performing server-side processing. In the simplest scenario we use the PopupControlSettingsBase.ShowOnPageLoad option to display the popup control initially. Note that we can pass any dynamic settings or content for the popup control through the ViewData dictionary. To show the popup control on the client side, we can call the ASPxClientPopupControlBase.Show() method. In addition we can use the ASPxClientPopupControlBase.SetContentHtml method to modify popup content on the client side.

Finally, there is a scenario when the popup control should be displayed after a callback of some other extension. Please review the T159638 - GridView - How to show a message after CRUD operations code example, where we have illustrated how this can be implemented.

See also:
How to make PopupControl stay open after submitting a form using Ajax.BeginForm

How to make PopupControl stay open after submitting a form using Ajax.BeginForm

How to integrate the Web Report Designer into an MVC web application

$
0
0
This example demonstrates how you can integrate the Web Report Designer into your web application. The application contains a simple report catalog, allowing you to add, delete, and edit reports whose layout data is stored in a custom data storage (i.e., an MS SQL database).

 

Additionally, this example demonstrates how you can add custom commands to the report designer menu at runtime to provide better integration with your application. In the example, the custom Save&Close menu command is introduced, which redirects you to the catalog page after saving the report.

 
Important note: Starting with version 15.2, the ReportStorageWebExtension is used to manage the reports storage for the Web Report Designer instead of the controller actions. 

Question Comments

Added By: bcoffee at: 4/6/2015 9:50:04 AM    

I'm trying to use this example to run a save report in DocumentViewer but I'm having no luck. Is it possible to extend this example to Run function in addition to Create, Edit and Delete?

Added By: Yaroslav (DevExpress Support) at: 4/6/2015 11:59:18 AM     To avoid discussing multiple topics in this thread, I've extracted your question to the How to run a save report in DocumentViewer ticket created on your behalf. Let's continue our conversation there.Added By: kuldip patel at: 3/29/2016 10:36:49 PM    I have seen this example.
While exporting report to PDF i wan to see which piece of code is getting executed.
Is it happening at client side or server side?

When i refred this link fo rthe same, and choose viewer as asp.net and tried exporting i can clearly see the api call happning. May i know how can i implement the same in this example.

https://demos.devexpress.com/MVCxReportDemos/WebSpecificFeatures/ReportDesignerReport?ShowAspNetViewer=1

How to implement a custom range filter using ASPxTrackBar in ASPxGridView

$
0
0

To create a custom range filter with the ASPxTrackBar, follow these steps:
1) Put ASPxTrackBar inside the GridViewColumn.FilterTemplate
2) Create a GridViewCommandColumn with two custom buttons to apply and clear filter conditions. 
3) Handle the ASPxClientGridView.CustomButtonClick event. In the event handler, set the filter expression. 
4) Handle the ASPxGridView.CustomButtonInitialize event to show and hide the ClearFilter button.
5) Use the ASPxTrackBar.JSProperties property to get the Min and Max values on the client side. 
6) Set the start and end positions of the track bar using the ASPxClientTrackBar.SetPositionStart and ASPxClientTrackBar.SetPositionEnd methods when the ClearFilter button is clicked.

GridView - How to implement select/unselect for all rows in a group row

ASPxGridView - How to implement select/unselect for all rows in a group row

$
0
0

This example demonstrates how to implement select/unselect for all rows in a group row.

It's possible to implement this behavior only by using ASPXGridView 9.1. For more information, please refer to Add client- and server-side methods to obtain rows belonging to a certain group.

First, place ASPxCheckBox and ASPxLabel into the Grid.Templates.GroupRowContent template.

Second, set the ASPxCheckBox.Checked property and the client-side ASPxCheckBox.ClientSideEvents.CheckedChanged event in the ASPxGridView.HtmlRowPrepared event handler.

In this example the ASPxLabel.Text is bound in the markup using Two-Way DataBinding.

MVC version: T362032: GridView - How to implement select/unselect for all rows in a group row

See also
How to implement select/unselect for all rows in a group row in ASPxGridLookup

Question Comments

Added By: Brian Dukes 2 at: 7/15/2013 8:39:14 AM    

I'm looking to do this exact thing in the latest 13.1.5 ASP.NET MVC controls -- How can this be done?

Added By: Gustavo Becerril at: 6/27/2014 4:38:28 PM    

This example doesn't take into account grouping by more than one field, it merely selects the first item of every subgroup. I'd love to find out if there's a not-so resource intensive way to select every item inside every subgroup.

Added By: Artem (DevExpress Support) at: 6/29/2014 11:36:17 PM    

Hello Gustavo,

I've moved your question to a separate thread created on your behalf: 
The E1760 example doesn't select all rows if ASPxGridView is grouped by several columns
Please refer to it for further correspondence.

Added By: Gherda Corrao at: 12/1/2014 3:29:29 AM    

I use 14.1.8 MVC Controls,
how can I select all rows in a group?

Added By: Mike (DevExpress Support) at: 12/1/2014 4:42:10 AM    

Hello Gherda,

To process your recent post more efficiently, I created a separate ticket on your behalf: T180839: E1760 for MVC - How to implement select/unselect for all rows in a group row. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: rushdan . at: 1/20/2015 7:44:15 PM    

Sorry,

I do not understand about this example. Refer to the markup below :

         <Templates>
               <GroupRowContent>
                  <table>
                      <tr><td>
                           <dx:ASPxCheckBox ID="checkBox" runat="server" />
                      </td><td>
                           <dx:ASPxLabel ID="CaptionText" runat="server" Text='<%# GetCaptionText(Container) %>' />
                      </td></tr>
                  </table>
               </GroupRowContent>
           </Templates>

I don't see the ASPxLabel and ASPxCheckBox in the example.

Refer to the markup below, the checkbox only available for ASPxGridView.

<dx:GridViewCommandColumn ShowSelectCheckbox="true" VisibleIndex="0" />

Added By: Vladimir (DevExpress Support) at: 1/20/2015 11:21:49 PM    

Hello,

Since demonstrated controls are placed into the GroupRowContent template, they appear only when ASPxGridView data is grouped by one or several columns. Please group data in the example to see the result.

Added By: dhouha babay 2 at: 3/22/2016 2:26:28 PM    is there some code for razor view engine?Added By: Lanette (DevExpress Support) at: 3/23/2016 12:44:45 AM    Hello,

If you need a sample project demonstrating the same scenario for MVC, I suggest you refer to the GridView - How to use the link to select and deselect all rows in a group example which demonstrates the same task.

ASPxGridView - How to sort records by selection

$
0
0

Since GridViewCommandColumn holds the command/interactive visual elements (but not any column's data), clicking its header does not perform any data shaping operation (such as sorting). If you need to perform data sorting based on the row's selection state (for instance, always display selected rows on top), consider implementing custom data sorting:

- Set each column's Settings.SortMode property to Custom.
- Handle the ASPxGridView.CustomColumnSort event.
- If both rows that should be compared have the same selection state, set the EventArgs e.Handled property to False in order to apply the default data comparing/sorting rules.
- If not, treat a selected row as a "stronger" one using the EventArgs e.Result property.

Question Comments

Added By: Igal Wolf at: 11/14/2012 5:39:48 AM    

It doesn't work


TreeList - How to move nodes using a context menu

$
0
0
This example illustrates how to move nodes using a context menu. It will be useful if your TreeList hierarchy is large and it's necessary to scroll a control/page to find the target node.
Question Comments

Added By: Ataur Rahaman 1 at: 3/30/2016 10:19:35 AM    Hi,
Can I show the context menu on mouse over. (like if I add an image with each node and on hover of that image will bring the popup menu) . How can I do that?

How to add custom ranges to the ArcScale in code

$
0
0

The ArcScale element has the Ranges property, providing access to the collection of custom ranges. You can populate this collection with instances of the ArcScaleRangeWeb class. This class has the following properties:

The AppearanceRange property provides the capability to define the BorderColor, BorderWidth and ContentColor of the ArcScaleRangeWeb.
The StartValue and EndValue properties allow you to set coordinates of the start and end points of the ArcScaleRangeWeb. These coordinates depend on the ArcScaleComponent.MinValue and ArcScaleComponent.MaxValue properties. Suppose, the ArcScaleComponent.MinValue = 30 and ArcScaleComponent.MaxValue = 90. For example, you can create two ArcScaleRangeWeb elements and set these StartValue and EndValue properties to the (30, 60) and (60, 90) to have two ranges, splitting the scale into two even parts.
The StartThickness and EndThickness properties allow you to define the thickness of the start and end of the ArcScaleRangeWeb.
The ShapeOffset property represents the spacing between the ArcScaleRangeWeb and the scale's edge. Setting negative values to this property moves the range to the center.

Question Comments

Added By: Ron McCain at: 3/30/2016 1:55:03 PM    where is the xaml file for this example

How to: Customize the ReportDataV2 Class

$
0
0
This example demonstrates how you can create additional properties in the Report Data class. For instance, adding the Category property will result in an additional column in the Reports List View, and end users will be able to group reports by categories.

WinForms:

ASP.NET:

The complete description is available in the How to: Add a Custom Column to the Reports List help topic.

GridView - A simple Batch Editing implementation

$
0
0

This example illustrates a simple implementation of a new ASPxGridView Batch Editing Mode functionality available starting with version 13.2:
ASP.NET WebForms & MVC: GridView Batch Edit (What's new in 13.2)

This example is a standalone DB-independent solution of the online Batch Editing demo. Refer to the demo's Description for more information.

Question Comments

Added By: Saitgalina Albina at: 3/30/2016 11:44:36 PM    Hello! I do the same in my project, but the data is not saved. In HomeController.cs batchValues.Insert.count = 0, batchValues.Update.Coumt = 0, batchValues.DeleteKey.column = 0 always coming.  What could be the reason? Added By: Mike (DevExpress Support) at: 3/31/2016 12:37:12 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T362286: GridView in Batch Edit Mode - Why BatchValue Count = 0 on Controller. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

GridView - Batch Editing - A simple implementation of an EditItem template

$
0
0

This example demonstrates how to create a custom editor inside column's DataItem template when GridView is in Batch Edit mode.

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

1. Specify column's EditItem template:

[C#]
       settings.Columns.Add(column=>       {           column.FieldName="C1";           column.SetEditItemTemplateContent(c=>           {               @Html.DevExpress().SpinEdit(spinSettings=>               {                   spinSettings.Name="C1spinEdit";                   spinSettings.Width=System.Web.UI.WebControls.Unit.Percentage(100);                   spinSettings.Properties.ClientSideEvents.KeyDown="C1spinEdit_KeyDown";                   spinSettings.Properties.ClientSideEvents.LostFocus="C1spinEdit_LostFocus";               }).Render();           });       });


2. Handle 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:

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


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

[JScript]
function Grid_BatchEditEndEditing(s, e){var productNameColumn = s.GetColumnByField("C1");if(!e.rowValues.hasOwnProperty(productNameColumn.index))return;var cellInfo = e.rowValues[productNameColumn.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:

[JScript]
function Grid_BatchEditRowValidating(s, e){var productNameColumn = s.GetColumnByField("C1");var cellValidationInfo = e.validationInfo[productNameColumn.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:

[JScript]
var preventEndEditOnLostFocus = false;function C1spinEdit_KeyDown(s, e){var keyCode = ASPxClientUtils.GetKeyCode(e.htmlEvent);if(keyCode !== 9 && keyCode !== 13)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:
ASPxGridView - Batch Editing - A simple implementation of an EditItem template 
GridView - Batch Editing - A simple implementation of an EditItemTemplate with client-side unobtrusive validation

Question Comments

Added By: Abdullah Garcia at: 5/14/2015 7:36:56 AM    

Is there any example that uses GridLookup instead of a SpinEdit?

Added By: Mike (DevExpress Support) at: 5/15/2015 12:57:34 AM    

I see you've created a separate ticket with this subject. We'll reply to you there. Please bear with us.

Added By: Saitgalina Albina at: 3/30/2016 11:52:31 PM    Hello! I do the same in my project, but the data is not saved. In HomeController.cs batchValues.Insert.count = 0, batchValues.Update.Coumt = 0, batchValues.DeleteKey.column = 0 always coming.  What could be the reason?  Added By: Mike (DevExpress Support) at: 3/31/2016 12:37:45 AM    Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T362286: GridView in Batch Edit Mode - Why BatchValue Count = 0 on Controller. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to: Allow a user to select the authentication type at runtime

$
0
0

To accomplish this task, you should create a new authentication type, inherited from the AuthenticationBase, and combine the code of the AuthenticationStandard and AuthenticationActiveDirectory classes in it. Additionally, you should create a custom logon parameters class with a property, allowing users to select the authentication type.

Question Comments

Added By: Raoulw at: 5/28/2012 11:14:21 AM    

Sample broken.

                            System.Reflection.MethodInfo mi = typeof(SecurityStrategyBase).GetMethod("InitializeNewUser", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);

Should be:

                            System.Reflection.MethodInfo mi = typeof(SecurityStrategyBase).GetMethod("InitializeNewUserCore", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);

In 11.2.11

Raoul.

Added By: Apostolis Bekiaris (DevExpress) at: 7/8/2013 10:02:55 PM    

Added to www.eXpandFramework.com 13.1.5.1 enjoy!

Added By: Yahya Mum at: 4/1/2014 11:38:19 PM    

Hello,
Thank you very much for this great functionality.
However I want the "UserName" and "Password" fields to be DISABLED , when the "ActiveDirectory" checkbox is checked. If it is unchecked then these values should be enabled again. It will be a better approach for the end users. How can I accomplish this. I tried using the "Appearance" module. But it didn't work.
For Example:
I put below Attribute above the UserName property
[Appearance("DisablePassword", Enabled = false, Criteria = "UseActiveDirectory",Context="DetailView")]
But didn't work.

Thanks.

Added By: Svatopluk Ulicny at: 4/9/2014 3:01:49 AM    

Hi, I has same question as Yahya Mum, is it possible?
Thanks

Added By: Carlitos at: 9/12/2014 7:17:36 AM    

I was having the same issue as Yahya and Martin. I solved it by merging codes from E2371, E3931 and https://documentation.devexpress.com/#Xaf/CustomDocument3475

Works like a charm now.

Added By: Michael (DevExpress Support) at: 9/15/2014 7:38:29 AM    To make dynamic appearance rules work correctly on the logon form, in addition to the code provided in the Use Conditional Appearance on the Logon Form article, you need to create a controller (and add it to the CreateLogonWindowControllers method of course) that will refresh the appearance when a property is changed.
[C#]
publicclassMyLogonController:ViewController<DetailView>{publicMyLogonController(){TargetObjectType=typeof(AuthenticationCombinedLogonParameters);}protectedoverridevoidOnActivated(){base.OnActivated();PropertyEditoreditor=View.FindItem("UseActiveDirectory")asPropertyEditor;if(editor!=null){editor.ValueStored+=newEventHandler(editor_ValueStored);}}voideditor_ValueStored(objectsender,EventArgse){Frame.GetController<AppearanceController>().Refresh();}}

We will address this issue in the future when improve the support for non-persistent objects.

How to implement a custom LookUpEdit supporting Server Mode

$
0
0

Starting with 15.2, ComboBoxEdit, LookUpEdit, and ListBoxEdit support server-side data processing out of the box. 

This example demonstrates how to create a custom editor that allows for the use of asynchronous server modes. 

Question Comments

Added By: Andrew Thornton at: 7/19/2013 10:32:51 AM    

Hi,

Just upgraded to 13.1.5, and this no longer compiles. Quite a few undocumented things looked to have changed.
Can we have a 13.4/5 version that works please?

Thanks.

Added By: Justin Zeng at: 4/17/2014 4:32:51 AM    

It seems many problem, can this function to be support in new version ?

Added By: Ivan (DevExpress Support) at: 4/27/2014 10:42:28 PM    

Hi Justin,

We cannot guarantee that this functionality will be available in the latest version. For now, you can try to extend this example manually. If you face difficulties doing this, do not hesitate to contact us.

Added By: Viktor Faerman at: 5/9/2014 1:57:04 AM    

Hi Alex,

how to implement this custom editor with MVVM?
Thanks, Viktor

Added By: Michael Ch (DevExpress Support) at: 5/9/2014 4:14:02 AM    Hello,

I have created a separate thread for your questions: How to implement a custom editor from the E4560 example with MVVM. Please refer to it for future discussion.

Thanks,
Michael

Added By: David Lemieux at: 8/12/2015 10:09:43 AM    

This probably does the trick for standalone lookup editors, but I have doubts about using this inside a grid. If my understanding of both the code below and the grid's mechanics is correct, a query will be issued for each and every cell for which such an editor is present. Therefore, if you have 20 records on screen with five columns each having such an editor, that's a hundred of connections opening, querying and closing right there. And EVEN with just ONE column, it will still be under-performing when it will be sorted, grouped or filtered. Even for the non-virtualized rows.

This needs a proper solution. Urgently.

Added By: Ivan (DevExpress Support) at: 8/13/2015 3:01:37 AM    

David, you are correct. The editor we implemented in this example is not designed to be used inside GridControl. With the current implementation, a new source/context will be created for each visible grid cell. Please refer to my comment in the LookUpEdit - server mode support ticket, where I clarified our plans regarding this feature.

Added By: Alexei Corduneanu 2 at: 9/4/2015 7:27:11 AM    

I'm trying to use this approach together with WcfInstantFeedbackDataSource.
As SelectedItem I'm setting the Item I've saved in the database previously. And I'm having a problem with loading the LookUpEdit value back because I'm getting "Value cannot be converted" error. I guess it's happens because the Item is not present in the datasource.
What should be a correct way to load the value back to this control?

Added By: Ilya (DevExpress Support) at: 9/4/2015 12:30:46 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T286248: How to modify E4560 so it properly works with a WcfInstantFeedbackDataSource. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Alexei Corduneanu 2 at: 10/6/2015 7:57:35 AM    

How could I achieve multiple selection using this control?

Added By: Ilya (DevExpress Support) at: 10/6/2015 11:27:36 AM    

Hi,
I have extracted your inquiry into a separate thread: How to enable multiple row selection in the LookUpEdit implementing Server Mode (E4560). Let's continue the discussion there.

Added By: Billy P at: 10/26/2015 7:40:23 PM    

How can I assign a null value when the text is cleared, like the behavior of AssignNullValueOnClearingEditText for ComboBoxEdit?

Added By: Michael Ch (DevExpress Support) at: 10/26/2015 10:07:05 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T304633: How to assign a null value when the text is cleared. This ticket is currently in our processing queue. Our team will address it as soon as we can.


How to implement unbound rows in PropertyGridControl

$
0
0

By default, unbound rows are not supported by PropertyGridControl. So, you can use VGridControl to display them.
However, PropertyGridControl allows you to provide custom property descriptors via the CustomDescriptors Event. So, you can implement the same functionality by creating a custom property descriptor that will store values for properties that do not present in the selected object.

This example demonstrates how this solution can be implemented.

Question Comments

Added By: Jeterson Miranda Gomes at: 3/31/2016 10:37:38 AM    hello, not find object used for UnboundRowsHelper, please, specify dependences for need for this exampleAdded By: Nikita (DevExpress Support) at: 3/31/2016 11:04:11 AM    Hello,
You can download the example runner and the full compilable sample using the link in the Download section: 

I hope this helps.

How to disable the save confirmation dialog when closing a DetailView for a new object left untouched by an end-user

$
0
0

Scenario
This example demonstrates how to implement the following behavior (which is default in Microsoft Outlook) in XAF Windows Forms applications:

- A user can create a new record, and when its detail form is opened he or she may close the form without entering any data (e.g., a new record was created by accident). In this case, the form can be closed without any save confirmation, because no user data needs to be saved.

- If a user enters some data into the form and then closes it, the save confirmation appears as expected not to lose entered data.

To implement it
Copy the WinSolution.Module.Win\SuppressConfirmationForNewObjectsDetailViewController.xx file into YourSolutionName.Module.Win project.


To test it
You can also run functional tests from the E2114.EasyTests\E2114.ets folder.

See Also:
WinModificationsController Class
ModificationsController.ModificationsHandlingMode
Core - Disable the confirmation dialog when closing a form with a new object left untouched

Question Comments

Added By: rushdan . at: 12/4/2014 2:08:46 AM    

I have see example . That is great.
So I would like to ask, is it possible to apply for Web ?

Thanks

Added By: Dennis (DevExpress Support) at: 12/4/2014 2:40:43 AM    @rushdan: This solution cannot be applied to the Web version because there are no such confirmation dialogs there by default.Added By: Paul Kubb at: 3/31/2016 9:04:33 PM    Just a little comment that I think this feature should be out-of-the-box.
Popping out this message every time even nothing touched is annoying and I don't think anybody will like it.

TreeList - How to move nodes using a context menu

$
0
0
This example illustrates how to move nodes using a context menu. It will be useful if your TreeList hierarchy is large and it's necessary to scroll a control/page to find the target node.
Question Comments

Added By: Ataur Rahaman 1 at: 3/30/2016 10:19:35 AM    Hi,
Can I show the context menu on mouse over. (like if I add an image with each node and on hover of that image will bring the popup menu) . How can I do that?Added By: Artem (DevExpress Support) at: 3/31/2016 3:41:41 AM    

Hello Ataur ,

To process your recent post more efficiently, I created a separate ticket on your behalf: T362411: TreeList - How to show a context menu on mouse over. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to create persistent classes mapped to tables with a composite primary key at runtime

$
0
0

When you have a table with a composite key, a usual solution is to declare a structure for the key member as described in the How to create a persistent object for a database table with a compound key article. If the database schema is not known as design time, and you need to create persistent classes at runtime, there is no option to create a structure-like entity as this functionality is supported only for real types via Reflection. The example demonstrates how to create a custom XPCustomMemberInfo descendant with nested members support.

See also:
K18482: How to create persistent metadata on the fly and load data from an arbitrary table

Question Comments

How to track changes made to persistent objects, and write them into a separate table

$
0
0

The OnSaving and OnDeleting method of the persistent objects can be overridden to log create/update/delete actions into a separate table. This example demonstrates the basic implementation of this feature.

Note: eXpressApp Framework have built-in module for Audit purposes. This example demonstrates how to use this module in non XAF application: How to use XAF Audit Trail module outside XAF.

Question Comments

Added By: Mohammed Al-Atari at: 10/8/2014 4:29:24 PM    

what about view record?
do you have code to get the below events
View
Login
Invalid Login
View List

Added By: Alexey (DevExpress Support) at: 10/9/2014 12:05:10 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T159303: Audit application events. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Reinhold Erlacher at: 4/2/2016 11:57:49 AM    Hello, could you help me to extend the sample to  track changes in many-many associations. I'd like to get left and right classes and oids.
Thanks
Reinhold


Viewing all 7205 articles
Browse latest View live


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