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

dxNumberBox - How to allow entering only integer/float numbers

$
0
0

This example demonstrates how to allow entering only numbers in dxNumberBox. For this task we need to handle the dxNumberBox.onKeyPress event and check whether the typed symbol is a number. If this is not a number, prevent the default action of the event by calling the preventDefault method of the event object that is passed to the onKeyPress event handler.

See also:
JavaScript RegExp

Question Comments

Added By: CM Tee at: 6/18/2015 9:06:10 PM    

hi, the syntax on view got error during runtime,

<div class="dx-field-value">
                   <div data-bind="dxNumberBox: integerSettings { value: qty, min: 1 }"></div>
               </div>

please help.

Added By: Alex Skorkin (DevExpress Support) at: 6/19/2015 1:20:53 AM    

Hello Jerry, 
To process your recent post more efficiently, I created a separate ticket on your behalf: T257499: The syntax for dxNumberBox interger values got error during runtime. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Jake Reece at: 4/24/2018 2:07:09 PM    The event name is onKeyPress, not onkeyPress.Added By: Alex Skorkin (DevExpress Support) at: 4/25/2018 12:09:50 AM    

Hi Jake, 

Thank you for bringing this to our attention. I've updated our example. My changes will be synced a bit later.

Added By: Coco panuncio at: 11/6/2018 6:42:43 AM    hello I am trying to run this example online but i don't think it is working because on the integer i can still input decimals. Any ideas of why?

Thanks!
Coco Added By: Coco panuncio at: 11/6/2018 6:48:11 AM    I see what the problem is, i downloaded the code and the code had the following:

[JavaScript]
$("#integerContainer").dxNumberBox({ valueChangeEvent: "keyup", onkeyPress: function(e){//this function name is not with the right casing "onKeyPress"var event = e.jQueryEvent, str = String.fromCharCode(event.keyCode);if(!/[0-9]/.test(str)) event.preventDefault();}});


How to print and export a WinForms Dashboard visual representation as is

$
0
0

The following example demonstrates a workaround that allows you to print and export a Dashboard visual representation as is via the Print Preview dialog.

In this example, the Customer Support dashboard is displayed. You can invoke the Print Preview for the dashboard in one of the two modes, using the Show Preview or Show Paged Preview button. In the first mode, the paper size is adjusted to fit the dashboard. In the second mode, the dashboard gets split across the appropriate number of standard A4 pages.

To accomplish this, we have created a DashboardExporter class that implements the DevExpress.XtraPrinting.IPrintable interface. DashboardExporter instances are mapped to a DashboardViewer when they are created and then passed to the Print Preview thus bringing the dashboard to paper.

Question Comments

Added By: S Broskie at: 2/12/2013 6:40:51 AM    

I appreciate the sample. I did have one question related to the size. If I squeeze the form down, which reduces the dashboard size and then do a print preview, the sides get chopped off. What would be the best way to keep the preview and export at a consistent size without having to worry about a user shrinking the form and therefore shrinking the output? Clone the dashboard somehow and actually do the export on that internally sized clone? If so, could you augment the sample to try and export a consistent size no matter what shape the form and dashboard are in?

Thanks!

Added By: DevInfox at: 3/12/2013 8:34:23 PM    

I used this code in a new dashboard viewer, how do I tell the button to print the dashboard and what about if I have multiple dashboard

Added By: saif Mohammed at: 9/18/2013 7:14:58 AM    

Hi, does this code consider the filtered dashboards or it prints it in its original status only?

Added By: Maxim (DevExpress Support) at: 6/9/2014 8:23:26 AM    Please accept my sincere apologies for this the tardiness of my reply. Although it's been a while since you posted these comments, I want to make sure your concerns are addressed. If you opened separate tickets on these issues, please let me know, so that I can follow up on all the tickets.  If you didn't, I will answer you here right away.Added By: swapna.makthal@jpmorgan.com swapna.makthal@jpmorgan.com at: 11/6/2018 10:06:08 AM    I see vertical and horizontal scroll bars in print preview page even though my dashboard viewer doesn't have them. Can you please let me know how to solve this issue?

How to avoid production of unnecessary column and merging of cells in Excel export

$
0
0

The XtraPivotGrid control is exported in a WYSIWYG (What You See Is What You Get) manner. According to this concept, items are exported as is, and this may cause an undesirable result. E.g. If column header width doesn't exactly match the field value width, the additional column will be produced. I'm afraid there is no way to avoid this problem in all cases. Let suppose that there are three Data Fields and only two Row Field. In this case, there is no any way to avoid cell merging without corrupting the layout.

Actually, we recommend turning off header export to avoid this problem. This can be done via the PivotGridOptionsPrint.PrintColumnHeaders, PivotGridOptionsPrint.PrintDataHeaders and PivotGridOptionsPrint.PrintFilterHeaders properties. However, in some cases, field headers may be necessary to describe the current pivot grid layout.

This example demonstrates how to create an ancillary Column Field that will have only one Field Value, which can be used to export a layout description. The PivotGridControl.CustomExportFieldValue event is used to provide a description to this field. Please note that you can generate any necessary string description by customizing the GetLayoutDiscription function.

Update: starting with version 15.1, the new Data-aware Export mode is available: WinForms &amp; ASP.NET Pivot Grid Controls - New Excel Data Export Engine

Question Comments

Added By: Mila Remigio at: 11/6/2018 12:49:43 PM    HI:

Can you please attach sample code for the ancillary column field with one Field Value for a WSYWIG export ?

Thanks

How to save a layout of LayoutControl together with its child controls

$
0
0

By default, if you save a layout of LayoutControl, settings of layout items are saved (Save and Restore Layout ). When you load the saved layout, layout items will be created with saved settings only if LayoutControl contains child controls, whose names exist in the saved layout. Otherwise, layout items will not be created. 


This example illustrates how to save settings of the child controls, too. For this, we have created two extension methods: SaveLayoutExToXml and RestoreLayoutExFromXml. These methods allow you to save and load child controls' settings. It makes sense to use these methods if it is necessary to re-create child controls from the saved layout with the saved settings. If a child control with the same name exists in LayoutControl, it will be removed and replaced by a new one retrieved from the saved layout. This approach is based on using a custom XmlXtraSerializer class. 

Question Comments

Added By: Ho-Jun Seo at: 9/4/2014 5:42:36 PM    

I am using version 12.1.12. It only has SaveLayoutToXml()  and RestoreLayoutFromXml(). So I cannot restore my layout with childs controls.
How can I use SaveLayoutExToXml()  and RestoreLayoutExFromXml() methods?

Added By: Andrey (DevExpress Support) at: 9/4/2014 11:03:29 PM    

Hello,
As I can see, you have created a separate How to use SaveLayoutExToXml() and RestoreLayoutExFromXml() methods?  thread. 

Since our support policy implies that every ticket is devoted to a separate issue, let's continue our discussion there.

Added By: Adam Ziegler at: 2/16/2018 9:47:53 AM    Boy, it sure would be a lot more helpful if this article also included the code for the two methods below. As it stands, it isn't helpful at all. Added By: Svetlana (DevExpress Support) at: 2/19/2018 6:03:58 AM    

Hi Adam,

This is not an article; it is a Code example that illustrates how to create two custom methods: SaveLayoutExToXml and RestoreLayoutExFromXml. Code of these methods is contained in the Serializer class of this example. To download this example, click the Example link on the right. You can also review this class' implementation by choosing Serializer.cs in the first combo box as shown in this screenshot

Added By: Francisco Matamoros at: 11/7/2018 4:43:45 AM    Hi, I am using this class to save the LayoutControlItems of a dynamic LayoutControlGroup.
When I generate each LayoutControlItem I use the Tag property to store an object from my database related to the LayoutControlItem.
When recovering with RestoreLayoutExFromXml I see that the Tag property despite being seen in the xml perfectly is not recovered.
Could I change something in the Serialized class so that it recovers correctly?
Thank you.

How to change a TreeList node position along with a corresponding record's position in the database

$
0
0

TreeList allows users to reorder nodes by dragging them with the mouse. If a node was moved from one parent to another, its position will be saved automatically, because it depends on the ParentID column value which is stored in the database. However, when nodes are reordered within the child collection, their position will be reset after the application is closed and opened again, or after reloading data.

To keep nodes positions, it is necessary to add additional column to the datasource to store the node index. In this situation, nodes positions can be restored after loading the data into the TreeList. This task can be accomplished by iterating all the nodes and updating the node index via the TreeList.SetNodeIndex method.

[C#]
voidUpdateNodesPositions(TreeListNodesnodes){List<TreeListNode>ns=newList<TreeListNode>();foreach(TreeListNodeninnodes)ns.Add(n);foreach(TreeListNodeninns){UpdateNodesPositions(n.Nodes);n.TreeList.SetNodeIndex(n,Convert.ToInt32(n.GetValue("Order")));}}
[VB.NET]
PrivateSub UpdateNodesPositions(ByVal nodes As TreeListNodes)Dim ns AsNew List(Of TreeListNode)()ForEach n As TreeListNode In nodes ns.Add(n)Next nForEach n As TreeListNode In ns UpdateNodesPositions(n.Nodes) n.TreeList.SetNodeIndex(n, Convert.ToInt32(n.GetValue("Order")))Next nEndSub

 
Note that the UpdateNodesPositions method should be called after TreeList is populated with data.  It's also necessary to handle the AfterDragNode event and update the "Order" field's values as follows:

[C#]
privatevoidtreeList1_AfterDragNode(objectsender,AfterDragNodeEventArgse){SaveNewRecordPosition(e);}privatevoidSaveNewRecordPosition(NodeEventArgse){varnodes=e.Node.ParentNode==null?e.Node.TreeList.Nodes:e.Node.ParentNode.Nodes;for(vari= 0;i<nodes.Count;i++){nodes[i].SetValue(colSort,i);}}
[VB.NET]
PrivateSub treeList_AfterDragNode(ByVal sender AsObject, ByVal e As AfterDragNodeEventArgs) Handles treeList1.AfterDragNode SaveNewRecordPosition(e) EndSubPrivateSub SaveNewRecordPosition(ByVal e As NodeEventArgs) Dim nodes = If(e.Node.ParentNode IsNothing, e.Node.TreeList.Nodes, e.Node.ParentNode.Nodes) For i = 0 To nodes.Count - 1 nodes(i).SetValue(colSort, i) Next i EndSub

How to provide an event that is raised on changing a grid layout

$
0
0

This example demonstrates how to provide an event that is raised as soon as a grid layout is changed.


In this example, we have created a GridLayoutHelper class that handles changes of the GridControl object's necessary properties and columns, and raises a custom event in its handlers.


This class can be easily attached to the GridControl object in the following manner:

[XAML]
<dxg:GridControlx:Name="grid"AutoPopulateColumns="True"><dxmvvm:Interaction.Behaviors><local:GridLayoutHelperLayoutChanged="OnGridLayoutChanged"/></dxmvvm:Interaction.Behaviors></dxg:GridControl>

 

To learn more on how to implement similar functionality in Silverlight, refer to the T243422 example.

Question Comments

Added By: bruno mandarà at: 4/4/2016 5:10:10 AM    not work, the change events, are only triggered for the last columnAdded By: Andrey K (DevExpress Support) at: 4/4/2016 6:13:35 AM    Thank you for the report. I will describe the cause of the issue and provide a solution in the T363569: How to subscribe to events of all GridControl columns thread. I will fix the current example as well.

Thanks,
AndreyAdded By: Sergei Polonski at: 7/25/2016 12:50:14 AM    The change events are not triggered, if i show/hide Groupfooter or if i change sort order.
Added By: Ivan (DevExpress Support) at: 7/25/2016 6:21:51 AM    

Hi Sergei,

Thank you for informing us of the issue. I've created a separate ticket on your behalf (T407133) and will address the issue there.

Added By: Irfan Kothari at: 7/7/2017 4:00:07 AM    
[C#]
columnwidthchangehandlerdoesn'twork.Imeannoneofpropertydescriptorwork.Ihadtochangebelowcodebyaddingcolumnscountcheck(&&Grid.Columns.Count> 0)butstillnoluck.if(Grid.Columns!=null){SubscribeColumns();}


Added By: Irfan Kothari at: 7/7/2017 4:27:30 AM    Tried below as well but it doesn't fire when we change column width
[C#]
DependencyPropertyDescriptor.FromProperty(GridColumn.ActualWidthProperty,typeof(GridColumn)).AddValueChanged(column,OnColumnWidthChanged);DependencyPropertyDescriptor.FromProperty(GridColumn.VisibleIndexProperty,typeof(GridColumn)).AddValueChanged(column,OnColumnVisibleIndexChanged);DependencyPropertyDescriptor.FromProperty(GridColumn.GroupIndexProperty,typeof(GridColumn)).AddValueChanged(column,OnColumnGroupIndexChanged);DependencyPropertyDescriptor.FromProperty(GridColumn.VisibleProperty,typeof(GridColumn)).AddValueChanged(column,OnColumnVisibleChanged);

Added By: Kirill (DevExpress Support) at: 7/7/2017 6:33:49 AM    

Hello, 
To process your recent post more efficiently, I've created a separate ticket on your behalf (T533540: How to track changes of GridColumn's Width property). It has been placed in our processing queue and will be answered shortly.

Thanks,
Kirill

Added By: Mohammed Abu Subha at: 11/8/2018 2:21:51 AM    Hi, 

I've applied it and it works fine but my issue is that when I have a best fit columns then they will lose the best fit column width when I am changing the width of specific column.

Regards,

ASPxDropDownEdit - How to select Year and Month only

$
0
0

UPDATED:

Starting from the 18.2 version of our controls, we support this scenario out of the box. Please review the Date and Time: Month-Year Picker demo.


This example demonstrates how to create a DateEdit counterpart based on ASPxDropDownEdit with a custom DropDownWindowTemplate, that will allow you to select Year and Month only.

Question Comments

Added By: Julien Joubert at: 2/8/2013 6:57:14 AM    

Hello,
Could you please provide a similar code for razor please?
Indeed, when I look at the events available inside settings.Properties.ClientSideEvents for @Html.DevExpress().DropDownEdit mvc extension, I don't have PrevClick, NextClick or OkClick and the closest for OnClick is ButtonClick.

Added By: Sergio Rios at: 5/12/2014 8:20:26 AM    

Awesome, with this kind of thing devexpress shows it really cares for the suscribers. Thanks.

Added By: Dhiogo Roberto at: 12/2/2014 4:23:39 AM    

I was thinking of applying these changes during the callback, what should I do? (Since it is applied in the Init event)

Added By: Larry (DevExpress Support) at: 12/3/2014 2:55:16 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T182140: ASPxDropDownEdit - How to select Year and Month only (server-side processing). This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Dhiogo Roberto at: 7/6/2015 1:10:20 PM    

It's not my case. The components are within the callbackpanel.

But how do this work since the init occurs before the callback?

Added By: Dhiogo Roberto at: 7/6/2015 1:13:10 PM    

I think there could be a native way to do this.

Added By: Helen (DevExpress Support) at: 7/6/2015 1:41:46 PM    

Hi Dhiogo,

I moved your comments to the T182140: ASPxDropDownEdit - How to select Year and Month only (server-side processing) thread and re-activated it. I suggest that you continue the discussion about your scenario in that ticket.

Added By: Jeff Vartiainen at: 10/31/2017 4:05:17 AM    Hi,

Is there an updated version of this, that shows a better interface?

Need a Month/Year only picker control for navigating records in ASP.Net XAF Project.

Thanks
Jeff Added By: Stason (DevExpress Support) at: 11/1/2017 2:20:21 AM    

Hello Jeff,

I've created a separate ticket on your behalf (T571319: DropDownEdit - How to select Year and Month only). We will address it shortly.

How to implement BootstrapGridView context menu with items similar to ASPxGridView

$
0
0

Starting with v18.2
, BootstrapGridView provides Context Menu out of the box: Context Menu Online Demo


For versions older than 18.2, use the approach below:

This example demonstrates how to implement BootstrapGridView context menu with items similar to ASPxGridView. These items include CRUD operations to Insert, Update, Delete data in BootstrapGridView's data source, operations to enable or disable FilterRowSearchPanel and GroupPanel, and operations to change Visible property of BootstrapGridView's columns.

The Javascript dictionary object is used to save BootstrapGridView's elements visibility states on client side.

In page markup, handle the BootstrapClientGridView.Init event and add event handler for contextmenu event of BootstrapGridView's main element. This event handler is used to set the Enabled and Text properties of BootstrapPopupMenu items depending on BootstrapGridView's elements visibility and clicked item index. To get the clicked item index, perform the following steps:
1) Call ASPxClientUtils.GetEventSource method to obtain the object that fired the current event.
2) Convert the object to jQuery object.
3) In page markup, set the CssClasses.Row property to the "grid-row" and pass that parameter to the parents method of the jQuery object to get GridView row javascript object.
4) Use the GetPageIndex method and a private BootstrapClientGridView's pageRowSize field of with applied to the jQuery GridView row object index method.
To receive the clicked BootstrapGridView item's ID on the client side, use BootstrapClientGridView.GetRowKey method.

Then handle the BootstrapGridView's CustomCallback event to add the current BootstrapGridView's elements visibility states to its JSProperties, and to transfer them from the server to the client. Handle BootstrapClientGridView.EndCallback event to get access to its JSProperties and to write updated BootstrapGridView's elements visibility states to the javasript dictionary.

Handle the BootstrapClientPopupMenu.ItemClick event to perform an action depending on the selected item. Use the ASPxClientMenuItem.name property to determine the selected item name and switch the applied action.
To manipulate BootstrapGridView data on the client side use AddNewRowStartEditRow and DeleteRowBootstrapClientGridView's methods.
To change BootstrapGridView's elements visibility states, call the BootstrapClientGridView.PerformCallback method.


How to add a custom button into LookupPropertyEditor to edit the currently selected record

$
0
0

To open a detail view for the currently selected object LookupPropertyEditor, you can press Ctrl+Shift while clicking the editor.
Another way is to implement your LookupPropertyEditor's descendant, which will provide the specific functionality you need.
LookupPropertyEditor is represented in a detail view by the LookUpEdit control, which allows various customizations. You can customize it by adding a special button that invokes a detail view for the selected object or performs any other actions.



See Also:

How to work with referenced properties via a simple drop down list instead of the standard LookupPropertyEditor (Example)

How to sort a ASPxPivotGrid by clicking on a field value

$
0
0

The PivotGrid allows sorting by any column. To do this, right click any field value and select an appropriate field to sort by it. Sometimes it is possible to sort by any column by simply clicking on it. This example shows how to implement this behavior. 

Question Comments

Added By: conservation at: 12/23/2012 7:09:38 PM    

I did it but i don't see the view pane of pivotGrid change anything. Could you please show me how to sort as the sort way that pivotgrid used when right click in header row or column and choose Sort "xxxx" by this Column/row ....
Just some necessary functions that i can use to sort pivotgrid view pane.
Thanks

Added By: Deepika K at: 11/11/2014 4:27:37 AM    

This code didn't work for me

Added By: Maxim (DevExpress Support) at: 11/11/2014 5:52:47 AM    

Hello Deepika,
I have created a separate thread for your inquiry. 
The E1439 example does not work properly
I will answer you as soon as possible. 

How to generate a sequential number for a persistent object within a database transaction (XAF)

$
0
0

This example illustrates one of the possible approaches to implementing an identifier field with sequential values. Alternate approaches are listed in the An overview of approaches to implementing a user-friendly sequential number for use with an XPO business class KB article.

Scenario

This is a variation of the How to generate and assign a sequential number for a business object within a database transaction, while being a part of a successful saving process XPO example, which was specially adapted for XAF applications.

In particular, for better reusability and more smooth integration with the standard XAF CRUD Controllers, all the required operations to generate sequences are managed within the base persistent class automatically when a persistent object is being saved. For more developer convenience, this solution is organized as a reusable XAF module - GenerateUserFriendlyId.Module. This module consists of several key parts:

    - Sequence and SequenceGenerator are auxiliary classes that take the main part in generating user-friendly identifiers. Take special note that the SequenceGenerator.Initialize method must be called during your XAF application startup for the correct operation.

    - UserFriendlyIdPersistentObject is a base persistent class that subscribes to XPO's Session events and delegates calls to the core classes above. Normally, you must inherit your own business classes from this base class to get the described functionality in your project.

    - IUserFriendlyIdDomainComponent is a base domain component that should be implemented by all domain components that require the described functionality.

Check the original example description first for more information on the demonstrated scenarios and functionality.




Steps to implement
1. Copy and include the GenerateUserFriendlyId.Module project into your solution and make sure it is built successfully.  Invoke the Module or Application Designer for the YourSolutionName.Module/Module.xx  or YourSolutionName.Wxx/WxxApplication.xx files by double-clicking it in Solution Explorer. Invoke the Toolbox (Alt+X+T) and then drag & drop the GenerateUserFriendlyIdModule component into the modules list on the left.

2. For apps with no security or with the Client-Side Security (XPObjectSpaceProvider or SecuredObjectSpaceProvider):
In the YourSolutionName.Wxx/WxxApplication.xx files, modify the CreateDefaultObjectSpaceProvider method to call the SequenceGenerator.Initialize method as shown in the Demo.Wxx\WxxApplication.xx files:

[C#]
protectedoverridevoidCreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgsargs){IXpoDataStoreProviderdataStoreProvider=XPObjectSpaceProvider.GetDataStoreProvider(args.ConnectionString,args.Connection,true);// Web:// IXpoDataStoreProvider dataStoreProvider = GetDataStoreProvider(args.ConnectionString, args.Connection);GenerateUserFriendlyId.Module.SequenceGenerator.Initialize(dataStoreProvider);...}

For apps with the Middle Tier Security (DataServerObjectSpaceProvider):
In the YourSolutionName.ApplicationServer project, locate and modify the serverApplication_CreateCustomObjectSpaceProvider or CreateDefaultObjectSpaceProvider  methods to call the SequenceGenerator.Initialize method in the same manner.


3.
 If you are using pure XPO classes, then inherit your business classes to which you want to add sequential numbers from the module's UserFriendlyIdPersistentObject class. Declare a calculated property that uses the SequenceNumber property of the base class to produce an string identifier according to the required format:

[C#]
publicclassContact:GenerateUserFriendlyId.Module.BusinessObjects.UserFriendlyIdPersistentObject{[PersistentAlias("Concat('C',PadLeft(ToStr(SequentialNumber),6,'0'))")]publicstringContactId{get{returnConvert.ToString(EvaluateAlias("ContactId"));}}

If you are using DC interfaces, then implement the IUserFriendlyIdDomainComponent interface by your custom domain component:

[C#]
publicinterfaceIDocument:GenerateUserFriendlyId.Module.BusinessObjects.IUserFriendlyIdDomainComponent{[Calculated("Concat('D',PadLeft(ToStr(SequentialNumber),6,'0'))")]stringDocumentId{get;}

Additionally for DC, use the UserFriendlyIdPersistentObject as a base class during your custom domain component registration, e.g.:

[C#]
XafTypesInfo.Instance.RegisterEntity("Document",typeof(IDocument),typeof(GenerateUserFriendlyId.Module.BusinessObjects.UserFriendlyIdPersistentObject));

Note that the sequential number functionality shown in this example does not work with DC shared parts , because it requires a custom base class, which is not allowed for shared parts.

4. By default, separate sequences are generated for each busienss object type. If you need to create multiple sequences for the same type, based on values of other object properties, override the GetSequenceName method and return the costructed sequence name. The Address class in this example uses separate sequences for each Province as follows:

[C#]
protectedoverridestringGetSequenceName(){returnstring.Concat(ClassInfo.FullName,"-",Province.Replace(" ","_"));}


5. For more information, download and review the Address, Contact, and IDocument types within the Demo.Module project. These are test business objects that demonstrate the use of the described functionality for XPO and DC respectively. Feel free to modify this example to add functionality as your business needs dictate.

 

IMPORTANT NOTES

1. As an alternative, you can implement much simpler solutions at the database level or by using the built-in DistributedIdGeneratorHelper.Generate method. Refer to the An overview of approaches to implementing a user-friendly sequential number for use with an XPO business class article for more details.

2.  In the Integrated Mode and middle-tier Application Server scenario the newly generated sequence number will appear in the DetailView only after a manual refresh (i.e., it will be empty right away after saving a new record), because the sequence is generated on the server side only and is not passed to the client. You can download a ready test project for these configurations here. See also the "Refresh the Identifier field value in UI" section in this KB article.
3. You can specify or seed the initial sequence value manually: either by editing the Sequence table in the database or using the standard XPO/XAF means by manipulating the Sequence objects, e.g.:

[C#]
using(IObjectSpaceos=Application.CreateObjectSpace(typeof(Sequence))){Sequencesequence=os.FindObject<Sequence>(CriteriaOperator.Parse("TypeName=?",typeof(E2829).FullName));sequence.NextSequence= 5;os.CommitChanges();}



Your feedback is needed!
We would greatly appreciate it if you share your feedback here in comments or rather participate in this short survey (~3 min).

Question Comments

Added By: Mr. Murat YILMAZ at: 10/7/2012 9:15:18 AM    

Thanks for the example. I developed ISequentialNumber domain component which based on this article and code. Now this sequential number functonatility shon in this example work with domain components and shared parts.

using System;
using System.Collections.Generic;
using System.ComponentModel;

using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using DevExpress.Xpo;
using DevExpress.Xpo.Metadata;
using DevExpress.ExpressApp;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Persistent.Validation;

using MyWay.Xaf.Module;
using MyWay.Xaf.Utils.Sequence;

namespace MyWay.Xaf.Module
{
    [DomainComponent]
    [NavigationItem]
    public interface ISequentialNumber
    {
        #region PROPERTIES

        #region SequentialNo

        [Persistent]
        string SequentialNo
        {
            get;
        }

        #endregion SequentialNo

        #region SequentialNumber
        
        [System.ComponentModel.Browsable(false)]
        [Indexed(Unique = false)]
        long SequentialNumber
        {
            get ;
            set;
        }

        #endregion SequentialNumber

        #endregion PROPERTIES
    }

    [DomainLogic(typeof(ISequentialNumber))]
    public class ISequentialNumberLogic
    {

            public static string Get_SequentialNo(ISequentialNumber instance)
            {
                return "asd" + instance.SequentialNumber.ToString();
            }

            

        private static object syncRoot = new object();
        private static SequenceGenerator sequenceGenerator;

        #region METHODS

        #region PUBLIC METHODS

        #region GenerateSequence

        public static void GenerateSequence(ISequentialNumber instance)
        {
            lock (syncRoot)
            {
                Dictionary<string, bool> typeToExistsMap = new Dictionary<string, bool>();

                foreach (object item in ((XPBaseObject)instance).Session.GetObjectsToSave())
                {
                    typeToExistsMap[((XPBaseObject)instance).Session.GetClassInfo(item).FullName] = true;
                }

                if (sequenceGenerator == null)
                {
                    sequenceGenerator = new SequenceGenerator(typeToExistsMap);
                }

                SubscribeToEvents(((XPBaseObject)instance).Session);
                OnSequenceGenerated(sequenceGenerator.GetNextSequence(((XPBaseObject)instance).ClassInfo), instance);
            }
        }

        #endregion GenerateSequence

        #endregion PUBLIC METHODS

        #region PROTECTED METHODS

        #region OnSaving

        public static void OnSaving(ISequentialNumber instance)
        {
            try
            {
                //base.OnSaving();
                if (((XPBaseObject)instance).Session.IsNewObject(instance) && !typeof(NestedUnitOfWork).IsInstanceOfType(((XPBaseObject)instance).Session))
                {
                    GenerateSequence(instance);
                }
            }
            catch
            {
                CancelSequence(((XPBaseObject)instance).Session);
                throw;
            }
        }

        #endregion OnSaving

        #endregion PROTECTED METHODS

        #region INTERNAL METHODS

        #endregion INTERNAL METHODS

        #region PRIVATE METHODS

        #region AcceptSequence

        private static void AcceptSequence(Session session)
        {
            lock (syncRoot)
            {
                if (sequenceGenerator != null)
                {
                    try
                    {
                        sequenceGenerator.Accept();
                    }
                    finally
                    {
                        CancelSequence(session);
                    }
                }
            }
        }

        #endregion AcceptSequence

        #region CancelSequence

        private static void CancelSequence(Session session)
        {
            lock (syncRoot)
            {
                UnSubscribeFromEvents(session);
                if (sequenceGenerator != null)
                {
                    sequenceGenerator.Close();
                    sequenceGenerator = null;
                }
            }
        }

        #endregion CancelSequence

        #region Session_AfterCommitTransaction

        private static void Session_AfterCommitTransaction(object sender, SessionManipulationEventArgs e)
        {
            
            AcceptSequence(e.Session);
        }

        #endregion Session_AfterCommitTransaction

        #region Session_AfterRollBack

        private static void Session_AfterRollBack(object sender, SessionManipulationEventArgs e)
        {
            CancelSequence(e.Session);
        }

        #endregion Session_AfterRollBack

        #region Session_FailedCommitTransaction

        private static void Session_FailedCommitTransaction(object sender, SessionOperationFailEventArgs e)
        {
            CancelSequence((Session)sender);
        }

        #endregion Session_FailedCommitTransaction

        #region SubscribeToEvents

        private static void SubscribeToEvents(Session session)
        {
            if (!(session is NestedUnitOfWork))
            {
                session.AfterCommitTransaction += Session_AfterCommitTransaction;
                session.AfterRollbackTransaction += Session_AfterRollBack;
                session.FailedCommitTransaction += Session_FailedCommitTransaction;
            }
        }

        #endregion SubscribeToEvents

        #region UnSubscribeFromEvents

        private static void UnSubscribeFromEvents(Session session)
        {
            if (!(session is NestedUnitOfWork))
            {
                session.AfterCommitTransaction -= Session_AfterCommitTransaction;
                session.AfterRollbackTransaction -= Session_AfterRollBack;
                session.FailedCommitTransaction -= Session_FailedCommitTransaction;
            }
        }

        #endregion UnSubscribeFromEvents

        #region OnSequenceGenerated

        private static void OnSequenceGenerated(long newId, ISequentialNumber instance)
        {
            instance.SequentialNumber = newId;
        }

        #endregion OnSequenceGenerated

        #endregion PRIVATE METHODS

        #endregion METHODS
    }
}

Added By: Luis Alberto Santiago at: 2/25/2013 8:06:36 PM    

Hi Mr. Murat YILMAZ, Can yo provide some example to use the class. I am looking it for shared parts

Added By: Andrew Bingham 2 at: 7/8/2013 3:38:51 AM    

I implemented this OK in a Solution

When I eimplmented it in a different solution I got an Exception
"Message: Value cannot be null.
Parameter name: Application"

thrown at:

    public static void Initialize() {
            Guard.ArgumentNotNull(Application, "Application");

Added By: Dennis (DevExpress Support) at: 7/11/2013 3:11:06 AM    

@Andrew: You forgot to add the following code:

public override void Setup(XafApplication application) {
            base.Setup(application);
            SequenceGeneratorInitializer.Register(application);
        }

You will not experience this and similar difficulties if you simply add the reusable module into your solution as per instructions above.

Added By: Carlitos at: 8/23/2014 6:46:05 PM    

Hi,
Is this now supported in Middle-Tier XAF applications?

Thanks,

Carlitos

Added By: Dennis (DevExpress Support) at: 8/25/2014 4:38:12 AM    

We have not performed additional R&D and testing of this particular example in a middle-tier scenario. Moreover, I see technical problems using this particular solution in this configuration, because here we use ExplicitUnitOfWork, which implies that it will be a sole owner of the database connection. Probably, for this configuration, it is better to stick to a standard solution, e.g. using database triggers. 

Added By: Carlitos at: 8/25/2014 9:34:23 AM    

Hi Dennis,
But how does the Middle-tier handle database connections? I thought it would do some sort of connection pooling and manage all client connections?

Why do you think that Triggers are a good alternative?

Carlos

Added By: Dennis (DevExpress Support) at: 8/26/2014 6:14:27 AM    

By default, the middle-tier app server uses ThreadSafeDataLayer to effectively handle requests from multiple clients at the same time. Connection pooling may be used here, but this is not managed by us by default and is rather controller by ADO.NET transparently for a consumer. My main concern here was that in such a multi-user environment it will not be possible to exclusively lock the connection by one user.
A solution at the database level looks more universal as it works at the database level and is irrelevant to whether the app server is used or not. 

Added By: Vishwas Mokashi at: 4/14/2015 11:21:58 AM    

In XAF application I have about 25 various business objects that need to generate unique user friendly sequence numbers in when saved. For example Customer Number, Invoice Number, Order Number, etc. Many users are going to work concurrently and everything should work in transaction.

Which approach should I use, the one in E2620 or E2829?.

I felt E2620 a bit better as I need not to inherit my classes (25 of them) from  UserFriendlyIdPersistentObject as shown in E2829.  

But approach in E2829 is said to be primarily for XAF applications

Added By: Dennis (DevExpress Support) at: 4/15/2015 4:47:25 AM    

@Vishwas: Both E2620  and E2829 demonstrate the same solution using ExplicitUnitOfWork. E2829 is just a bit better integrated with the XAF infrastructure.
If you do not want to inherit from a common base class, I suggest you consider using How to generate a sequential and user-friendly identifier field within a business class, which is simpler to implement and provides similar capabilities without using ExplicitUnitOfWork.

Added By: Vishwas Mokashi at: 4/17/2015 6:54:45 AM    

OK thanks Dennis.

Will simpler approach in "How to generate a sequential and user-friendly identifier field within a business class" handle concurrent users creating same business objects properly?. We can assume about 25 Concurrent users for same business object, with SQL Server DB.

Some users will be accessing system over low banddwidth VPN internet connection. (for Sale Invoice object which needs to generate sequencial Invoice Numbers)

Added By: Dennis (DevExpress Support) at: 4/20/2015 7:58:16 AM    

@Vishwas: Yes, it will. The DistributedIdGeneratorHelper class tries to save a record and repeats its attempts several times until it reaches the maximum number or saves data completely. Check out the corresponding source code for more details on how this works.

    public static class DistributedIdGeneratorHelper {
        public const int MaxIdGenerationAttemptsCounter = 7;
        public static int Generate(IDataLayer idGeneratorDataLayer, string seqType, string serverPrefix) {
            for(int attempt = 1; ; ++attempt) {
                try {
                    using(Session generatorSession = new Session(idGeneratorDataLayer)) {
                        CriteriaOperator serverPrefixCriteria;
                        if(serverPrefix == null) {
                            serverPrefixCriteria = new NullOperator("Prefix");
                        }
                        else {
                            serverPrefixCriteria = new BinaryOperator("Prefix", serverPrefix);
                        }
                        OidGenerator generator = generatorSession.FindObject<OidGenerator>(
                            new GroupOperator(new BinaryOperator("Type", seqType), serverPrefixCriteria));
                        if(generator == null) {
                            generator = new OidGenerator(generatorSession);
                            generator.Type = seqType;
                            generator.Prefix = serverPrefix;
                        }
                        generator.Oid++;
                        generator.Save();
                        return generator.Oid;
                    }
                }
                catch(LockingException) {
                    if(attempt >= MaxIdGenerationAttemptsCounter)
                        throw;
                }
            }
        }Added By: Vishwas Mokashi at: 4/21/2015 6:03:28 AM    

Thanks Dennis

Added By: Konstantin B (DevExpress) at: 12/4/2017 1:20:01 AM    Update: This example illustrates one of the possible approaches to implementing an identifier field with sequential values. Alternate approaches are listed in the An overview of approaches to implementing a user-friendly sequential number for use with an XPO business class KB article.Added By: Cecil Carter at: 3/3/2018 7:30:11 AM    I've tried running the example scenario against a MySQL database and I'm receiving the following error. I assume this is related to the SQL statement generated by the ORM for MySQL. Is there a possible work around to this error?

DevExpress.ExpressApp.Updating.CompatibilityException
  HResult=0x80131509
  Message=Unable to create 'PrimaryKey' 'PK_Sequence'. Parent: 'Sequence'. Error: Executing Sql 'alter table `Sequence` add constraint `PK_Sequence` primary key (`TypeName`)' with parameters '' exception 'MySql.Data.MySqlClient.MySqlException (0x80004005): BLOB/TEXT column 'TypeName' used in key specification without a key length
   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
   at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at DevExpress.Xpo.Logger.LogManager.Log[T](String category, LogHandler`1 handler, MessageHandler`1 createMessageHandler)
   at DevExpress.Xpo.DB.ConnectionProviderSql.ExecSql(Query query)'
  Source=DevExpress.ExpressApp.v17.2
  StackTrace:
   at DevExpress.ExpressApp.Updating.DatabaseUpdater.Update()
   at GenerateUserFriendlyId.Win.GenerateUserFriendlyIdWindowsFormsApplication.GenerateUserFriendlyIdWindowsFormsApplication_DatabaseVersionMismatch(Object sender, DatabaseVersionMismatchEventArgs e) in C:\Users\Cecil Carter\Downloads\eXpressApp Framework\17.2.5\E2829\Demo.Win\WinApplication.cs:line 26
   at DevExpress.ExpressApp.XafApplication.OnDatabaseVersionMismatch(DatabaseVersionMismatchEventArgs args)
   at DevExpress.ExpressApp.XafApplication.CheckCompatibilityCore()
   at DevExpress.ExpressApp.XafApplication.CheckCompatibility()
   at DevExpress.ExpressApp.XafApplication.Logon(PopupWindowShowActionExecuteEventArgs logonWindowArgs)
Inner Exception 1:
UnableToCreateDBObjectException: Unable to create 'PrimaryKey' 'PK_Sequence'. Parent: 'Sequence'. Error: Executing Sql 'alter table `Sequence` add constraint `PK_Sequence` primary key (`TypeName`)' with parameters '' exception 'MySql.Data.MySqlClient.MySqlException (0x80004005): BLOB/TEXT column 'TypeName' used in key specification without a key length
   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
   at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at DevExpress.Xpo.Logger.LogManager.Log[T](String category, LogHandler`1 handler, MessageHandler`1 createMessageHandler)
   at DevExpress.Xpo.DB.ConnectionProviderSql.ExecSql(Query query)'
Inner Exception 2:
SqlExecutionErrorException: Executing Sql 'alter table `Sequence` add constraint `PK_Sequence` primary key (`TypeName`)' with parameters '' exception 'MySql.Data.MySqlClient.MySqlException (0x80004005): BLOB/TEXT column 'TypeName' used in key specification without a key length
   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
   at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at DevExpress.Xpo.Logger.LogManager.Log[T](String category, LogHandler`1 handler, MessageHandler`1 createMessageHandler)
   at DevExpress.Xpo.DB.ConnectionProviderSql.ExecSql(Query query)'
Inner Exception 3:
MySqlException: BLOB/TEXT column 'TypeName' used in key specification without a key length

Added By: Dennis (DevExpress Support) at: 3/5/2018 12:35:24 AM    

@Cecil Carter: I've created a separate ticket on your behalf (T612198: MySql - The "BLOB/TEXT column 'XXX' used in key specification without a key length" error may occur when using a string key property). It has been placed in our processing queue and will be answered shortly.

[OBSOLETE] BootstrapGridView - Batch Edit mode - How to edit CheckBox column in a single click

$
0
0

Starting with v17.1.4 and v17.2.3, the BootstrapGridView control supports this functionality out of the box. To get the desired behavior, enable the AlwaysShowCheckboxesInCheckColumns property:

[ASPx]
<SettingsEditing><BatchEditSettingsAlwaysShowCheckboxesInCheckColumns="true"/></SettingsEditing>

 The approach demonstrated in the example is OBSOLETE. It should be used with old versions only.


In old versions, BootstrapGridView displayed cells in CheckBox columns as images which makes it impossible to edit these cells in a single click. First, you have to click the cell to enter the edit mode and the second click actually changes the value. It is not very convenient, so we created a workaround that allows editing such columns in a single click.

For this, define a data item template for the CheckBox column and place an actual check box there. Synchronize this check box with the item collection - obtain the value using the Eval (or Bind) method and set a new value with SetCellValue.

How to import HTML files containing images referenced using custom prefix

$
0
0

By default, RichEditControl can import HTML files containing embedded images or links to external images with the src attribute specified as an image URL. Occasionally, you may have a web file where images are referenced in a custom manner (e.g. using the prefix 'cid' in the img src attribute, as in email files). In this scenario, you should implement and register a custom IUriStreamProvider to import these files into a RichEditControl correctly. This example illustrates the technique used to get an image referenced with the "cid" prefix from an external file in "bmp" format.

See Also:
Building a mail application with the RichEditControl

Question Comments

Added By: Jaap van der Have at: 5/16/2017 11:38:27 PM    Thanks for the great example, i made the following changes to it so it detects errors and imageformat. Also a very important thing is to set the RicheditControl to async if you want to wait for the loading to finish before continueing (and have not all images loaded yet). 
RicheditControlName.Options.Import.Html.AsyncImageLoading = false;

Also see https://www.devexpress.com/Support/Center/Question/Details/T515172 (also for a bigger example based on html import and outlook embedded mail

[C#]
// HTMLImport (https://www.devexpress.com/Support/Center/Example/Details/E3123)privateclassCustomUriStreamProvider:IUriStreamProvider{privatestringbasePath;//private string imageExtension;publicstringBasePath{get{returnbasePath;}set{basePath=value;}}publicCustomUriStreamProvider(stringbasePath){BasePath=basePath;}privatestaticSystem.Drawing.Imaging.ImageFormatGetImageFormat(System.Drawing.Imageimg){if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg))returnSystem.Drawing.Imaging.ImageFormat.Jpeg;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Bmp))returnSystem.Drawing.Imaging.ImageFormat.Bmp;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Png))returnSystem.Drawing.Imaging.ImageFormat.Png;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Emf))returnSystem.Drawing.Imaging.ImageFormat.Emf;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Exif))returnSystem.Drawing.Imaging.ImageFormat.Exif;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif))returnSystem.Drawing.Imaging.ImageFormat.Gif;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Icon))returnSystem.Drawing.Imaging.ImageFormat.Icon;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.MemoryBmp))returnSystem.Drawing.Imaging.ImageFormat.MemoryBmp;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Tiff))returnSystem.Drawing.Imaging.ImageFormat.Tiff;else{System.Diagnostics.Debug.Print("Cannot find type use it as a WMF image");returnSystem.Drawing.Imaging.ImageFormat.Wmf;}}publicStreamGetStream(stringurl){//string fileName = string.Format("{0}", url.Replace("cid:", string.Empty));stringfileName=string.Format("{0}",url.Replace("cid:",string.Empty));try{if(File.Exists(BasePath+fileName)){MemoryStreammemoryStream=newMemoryStream();Imageimage=Image.FromFile(BasePath+fileName);System.Diagnostics.Debug.Print("Loading Image: "+BasePath+fileName);image.Save(memoryStream,GetImageFormat(image));memoryStream.Seek(0,SeekOrigin.Begin);returnmemoryStream;}else{thrownewFileNotFoundException(@"File "+BasePath+fileName+" is not found");}}catch(Exceptionex){XtraMessageBox.Show("Error loading image "+BasePath+fileName+" from html template possible corrupt file?\r\n\r\n"+ex);returnnull;}}}// ExportprivateclassRichEditMailMessageExporter:IUriProvider{readonlyRichEditControlcontrol;readonlyOutlook._MailItemmailItem;intimageId;stringtempFiles=Path.Combine(Directory.GetCurrentDirectory(),"TempFiles");publicRichEditMailMessageExporter(RichEditControlcontrol,Outlook._MailItemmailItem){Guard.ArgumentNotNull(control,"control");Guard.ArgumentNotNull(mailItem,"mailItem");this.control=control;this.mailItem=mailItem;}publicvirtualvoidExport(){if(!Directory.Exists(tempFiles))Directory.CreateDirectory(tempFiles);control.BeforeExport+=OnBeforeExport;stringhtmlBody=control.Document.GetHtmlText(control.Document.Range,this);control.BeforeExport-=OnBeforeExport;mailItem.BodyFormat=Outlook.OlBodyFormat.olFormatHTML;mailItem.HTMLBody=htmlBody;}privatevoidOnBeforeExport(objectsender,BeforeExportEventArgse){HtmlDocumentExporterOptionsoptions=e.OptionsasHtmlDocumentExporterOptions;if(options!=null){options.Encoding=Encoding.UTF8;}}#regionIUriProviderMemberspublicstringCreateCssUri(stringrootUri,stringstyleText,stringrelativeUri){returnString.Empty;}publicstringCreateImageUri(stringrootUri,OfficeImageimage,stringrelativeUri){stringimageName=String.Format("image{0}.png",imageId);imageId++;stringimagePath=Path.Combine(tempFiles,imageName);image.NativeImage.Save(imagePath,ImageFormat.Png);mailItem.Attachments.Add(imagePath,Outlook.OlAttachmentType.olByValue, 0,Type.Missing);return""+imageName;//using cid: breaks images in my webmail (squirrelmail)}#endregion}



Added By: Jaap van der Have at: 5/17/2017 5:31:36 AM    I changed it a bit so it is possible to have a type of error checking/messaging: 

This is in the normal method, i also unregister it after the import:
[C#]
// Custom IUriStreamProvider registrationIUriStreamServiceuriStreamService=rBox.GetService<IUriStreamService>();varHTMLimport=newCustomUriStreamProvider(imagePath);uriStreamService.RegisterProvider(HTMLimport);rBox.Options.Import.Html.AsyncImageLoading=false;rBox.HtmlText=html;if(HTMLimport.HasErrorMessage!=string.Empty){thrownewSystem.Exception(HTMLimport.HasErrorMessage);}uriStreamService.UnregisterProvider(HTMLimport);SetDefaultFont(rBox);

And this is the class:
[C#]
// HTMLImport (https://www.devexpress.com/Support/Center/Example/Details/E3123)#regionHTMLImportClassprivateclassCustomUriStreamProvider:IUriStreamProvider{privatestringbasePath;//private string imageExtension;publicstringBasePath{get{returnbasePath;}set{basePath=value;}}publicstringHasErrorMessage{get;privateset;}publicCustomUriStreamProvider(stringbasePath){HasErrorMessage=string.Empty;BasePath=basePath;}privatestaticSystem.Drawing.Imaging.ImageFormatGetImageFormat(System.Drawing.Imageimg){if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg))returnSystem.Drawing.Imaging.ImageFormat.Jpeg;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Bmp))returnSystem.Drawing.Imaging.ImageFormat.Bmp;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Png))returnSystem.Drawing.Imaging.ImageFormat.Png;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Emf))returnSystem.Drawing.Imaging.ImageFormat.Emf;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Exif))returnSystem.Drawing.Imaging.ImageFormat.Exif;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif))returnSystem.Drawing.Imaging.ImageFormat.Gif;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Icon))returnSystem.Drawing.Imaging.ImageFormat.Icon;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.MemoryBmp))returnSystem.Drawing.Imaging.ImageFormat.MemoryBmp;if(img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Tiff))returnSystem.Drawing.Imaging.ImageFormat.Tiff;else{System.Diagnostics.Debug.Print("Cannot find type use it as a WMF image");returnSystem.Drawing.Imaging.ImageFormat.Wmf;}}publicStreamGetStream(stringurl){stringfileName=string.Format("{0}",url.Replace("cid:",string.Empty));try{if(File.Exists(BasePath+fileName)){MemoryStreammemoryStream=newMemoryStream();Imageimage=Image.FromFile(BasePath+fileName);System.Diagnostics.Debug.Print("Loading Image: "+BasePath+fileName);image.Save(memoryStream,GetImageFormat(image));memoryStream.Seek(0,SeekOrigin.Begin);returnmemoryStream;}else{thrownewFileNotFoundException(@"File "+BasePath+fileName+" is not found");}}catch(Exceptionex){this.HasErrorMessage="Error loading image "+BasePath+fileName+" from html template possible corrupt file?\r\n\r\n"+ex;returnnull;}}}#endregion// Export#regionEmbeddedimageExportprivateclassRichEditMailMessageExporter:IUriProvider{readonlyRichEditControlcontrol;readonlyOutlook._MailItemmailItem;intimageId;stringtempFiles=Path.Combine(Directory.GetCurrentDirectory(),"TempFiles");publicRichEditMailMessageExporter(RichEditControlcontrol,Outlook._MailItemmailItem){Guard.ArgumentNotNull(control,"control");Guard.ArgumentNotNull(mailItem,"mailItem");this.control=control;this.mailItem=mailItem;}publicvirtualvoidExport(){if(!Directory.Exists(tempFiles))Directory.CreateDirectory(tempFiles);control.BeforeExport+=OnBeforeExport;stringhtmlBody=control.Document.GetHtmlText(control.Document.Range,this);control.BeforeExport-=OnBeforeExport;mailItem.BodyFormat=Outlook.OlBodyFormat.olFormatHTML;mailItem.HTMLBody=htmlBody;}privatevoidOnBeforeExport(objectsender,BeforeExportEventArgse){HtmlDocumentExporterOptionsoptions=e.OptionsasHtmlDocumentExporterOptions;if(options!=null){options.Encoding=Encoding.UTF8;}}#regionIUriProviderMemberspublicstringCreateCssUri(stringrootUri,stringstyleText,stringrelativeUri){returnString.Empty;}publicstringCreateImageUri(stringrootUri,OfficeImageimage,stringrelativeUri){stringimageName=String.Format("image{0}.png",imageId);imageId++;stringimagePath=Path.Combine(tempFiles,imageName);image.NativeImage.Save(imagePath,ImageFormat.Png);mailItem.Attachments.Add(imagePath,Outlook.OlAttachmentType.olByValue, 0,Type.Missing);return""+imageName;//using cid: breaks images in my webmail (squirrelmail)}#endregion}#endregion










OBSOLETE - How to show custom forms and controls in XAF (Example)

$
0
0

==============================
This article is now obsolete. Instead, refer to the eXpressApp Framework> Concepts> UI Construction> Using a Custom Control that is not Integrated by Default overview article and the following two help topics in particular:
    eXpressApp Framework> Task-Based Help> How to: Show a Custom Data-Bound Control in an XAF View (WinForms)
    eXpressApp Framework > Task-Based Help > How to: Show a Custom Data-Bound Control in an XAF View (ASP.NET)
    Concepts  > UI Construction  > Views  > Ways to Show a View
    How to: Show a Custom Windows Form
    How to: Show a Custom Window with an Embedded XAF View
    Ways to Show a Confirmation Dialog 

==============================
This example implements the following scenarios when an end-user clicks on a custom item in the navigation control:

- a custom non-XAF form is opened as a result;

- a standard XAF View containing a custom user control is opened as a result.


Both custom forms and user controls display persistent data from the XAF application database. For that purpose, this example solution provides a set of reusable elements (custom ViewItem and Application Model extensions) organized in a way that you can once implement them in an XAF module and reuse to display custom user controls in various forms.


IMPORTANT NOTES
If you do not require a complex and reusable solution for this task, it is recommended to use a much simpler and built-in XAF solution - ControlDetailItem placed within a DashboardView. This item can be added and customized as described at eXpressApp Framework > Task-Based Help > How to: Create a Custom Control Detail Item. See also the Using a Control that is not Integrated by Default article for other integration options.

If this is NOT your case, proceed to the instructions below.

STEPS TO IMPLEMENT

1.
Define a base structure of the navigation control in your XAF application, as shown in the E911.Module\Model.DesignedDiffs.xafml file.

You can simply copy and paste the contents of the NavigationItems element into the corresponding file (pre-opened via the text editor) of your platform-agnostic module.

The same customizations can be achieved via the Model Editor visually.
Take special note that you can set the View parameter to any View from the list, e.g. AboutInfo_DetailView, BaseObject_ListView, etc.

This navigation structure will be further customized in the WinForms and ASP.NET executable projects later.


2. Intercept events of the navigation control to display a custom form when a custom navigation item is clicked.

To do this, implement a WindowController into your platform-agnostic module and handle events of the ShowNavigationItemController class as per the E911.Module\Controllers\ShowCustomFormWindowController.xx file. This controller will be abstract and be overridden in WinForms and ASP.NET modules.


3. Declare a custom ViewItem class that is supposed to host a custom user control in the standard XAF View. To do this, implement a custom ViewItem descendant and related types in the platform-agnostic module as shown in the E911.Module\Editors\CustomUserControlViewItem.xx file.

This ViewItem will also be abstract and platform-agnostic as it will not create platform-dependent controls, and will just provide a common customization code for both platforms. For instance, the OnControlCreated method will be overridden to bind the created control to data. To access persistent data from the database used by an XAF application, the ViewItem will implement the IComplexViewItem interface that consists of a single Setup method, receiving the IObjectSpace and XafApplication objects as parameters.

To unify our data binding code for both platforms, the IXpoSessionAwareControl interface and an auxiliary XpoSessionAwareControlInitializer class are introduced.

The interface provides a single UpdateDataSource method that is implemented by custom forms and user controls to bind them to data received by means of XPO.

You can use a similar mechanism and modify these auxiliary types to pass other custom data into your custom forms and controls.


4. Define a base structure of the standard XAF View with a custom ViewItem as shown in the E911.Module\Model.DesignedDiffs.xafml file.

You can simply copy and paste the contents of the Views element into the corresponding file (pre-opened via the text editor) of your platform-agnostic module.


5. Create custom forms and user controls in WinForms and ASP.NET executable projects analogous with what is shown in the example. The easiest way to do this is to copy the contents of the E911.Win\Controls and E911.Web\Controls folders and then include the necessary files into your solution. Take special note that these custom forms and controls implement the IXpoSessionAwareControl interface to automatically receive persistent data and other parameters when they are created.


6. Implement platform-dependent behavior to open and customize custom forms and controls. To do this, copy the following files into your WinForms and ASP.NET module projects:

WinForms:

E911.Module.Win\Controllers\WinShowCustomFormWindowController.xx - contains an WinForms version of the WindowController, which is inherited from the platform-agnostic

E911.Module.Win\Editors\WinCustomUserControlViewItem.xx - contains an WinForms version of the ViewItem, which is inherited from the platform-agnostic one;

E911.Module.Win\WinModuleEx.xx - contains a registration code for WinForms version of the ViewItem;


ASP.NET:

E911.Module.Web\Editors\WebCustomUserControlViewItem.xx - contains an ASP.NET version of the ViewItem, which is inherited from the platform-agnostic one;

E911.Module.Web\WebModuleEx.xx - contains a registration code for ASP.NET version of the ViewItem;

E911.Module.Web\Controllers\WebShowCustomFormWindowController.xx - contains an ASP.NET version of the WindowController, which is inherited from the platform-agnostic one;


These platform-dependent versions of the WindowController and ViewItem are required to implement the creation and display of custom forms and controls using the means specific for each platform. They are also designed to provide the capability to be able to set custom forms and control settings via the Model Editor. For that purpose, custom Application Model extensions are implemented for the Navigation Item and View Item model elements.


7. Set the custom forms and controls settings for each platform.

To do this, copy the contents of the E911.Win\Model.xafml and E911.Web\Model.xafml files into the Model.xafml file in the executable WinForms and ASP.NET projects:

WinForms:

ASP.NET:

 

OTHER IMPLEMENTATION CONSIDERATIONS

1. It is also possible to mix the traditional and XAF development approaches (consult our Support Team if you are not sure how to integrate your standard non-XAF solution into XAF), because an XAF application is a regular .NET application built of reusable blocks like View, ViewItem, Property and List Editors, etc. that eventually create and customize platform-dependent controls exactly the same way you do this without XAF. So, using XAF does not mean something absolutely new and allows you to reuse your existing development skills and practices. Of course, it is possible to create your own reusable blocks if the standard ones do not meet your needs. For instance, the example of a custom View class designed to show a custom form can be found on CodeProject here.


2. This solution contains some generic code (e.g., base WindowController and ViewItem) that is mainly required because our XAF application is for both Windows and the Web. You may avoid this generic code and make a simpler implementation if you are developing for only one platform.


3. You can display custom forms not only when interacting with the navigation control, but from any other place. To do this, intercept the events of a required entity, e.g., an XAF Controller, Action or a View. Refer to the product documentation or consult with our Support Team in case of any difficulties.


4. By default controls layout and user customizations are preserved only for built-in XAF ListEditors, because they have special code for that. If you embed a custom user control into XAF, you need to preserve its settings yourself as well, exactly like you would do when implementing this task in the "old way" in a non-XAF application. Refer to the control's documentation to learn more on how to accomplish this task.

Feel free to contact the respective product team if you experience any difficulties customizing this control.


See also:
How to create controls dynamically
How much of XAF's default UI is customizable.
How to Show a Window via an Action
How to: Display a List of Non-Persistent Objects
How to: Display a Non-Persistent Object's Detail View from the Navigation
ShowNavigationItemController.CustomShowNavigationItem Event
XafApplication.CustomProcessShortcut Event

Question Comments

Added By: kenngo at: 11/6/2012 2:24:10 AM    

Hi, I would like the custom from to be tabbedMDI, how to set this in the controller class?

Added By: Dennis (DevExpress Support) at: 2/1/2013 6:12:45 AM    

@Ngo Ken Hui:
Refer to the Q391718 ticket that describes a possible solution.

Added By: Alan mahone at: 4/26/2013 8:39:40 AM    

i have a problem in CustomUserControlViewItem.cs file
 in line "new XpoSessionAwareControlInitializer(Control as IXpoSessionAwareControl, theObjectSpace);"
the Control is converted to null

Added By: Dennis (DevExpress Support) at: 4/26/2013 8:43:18 AM    

Please submit a new ticket and attach your problematic project there:
http://www.devexpress.com/Support/Center/Question/Create
We will be glad to help you.

Added By: Andrew Bingham 2 at: 6/5/2013 10:11:58 AM    

The downloaded solution states it is for " v13.1".

The latest version I am aware of is 12.2?

Added By: Carl Howarth 1 at: 10/11/2013 4:00:36 AM    

Just in case anyony else hits the issue where the model.CustomControlTypeName is null; there are some additional model settings that are not included in the example code below (but are in the actual download).

Have a look at the XML for the E911.Module.Win/Web Model.xafml. You will notice that there are settings within these files that are not detailed below (it may be obvious to some based on the article but I missed it and it cost me the best part of a day).

Win version:
<Application>
  <NavigationItems>
    <Items>
      <Item Id="Default">
        <Items>
          <Item Id="CustomForm" CustomFormTypeName="E911.Module.Win.Controls.WinCustomForm" />
        </Items>
      </Item>
    </Items>
  </NavigationItems>
  <Views>
    <DashboardView Id="StandardFormWithCustomUserControl">
      <Items>
        <CustomUserControlViewItem Id="CustomUserControlViewItem" CustomControlTypeName="E911.Module.Win.Controls.WinCustomUserControl" />
      </Items>
    </DashboardView>
  </Views>
</Application>

Web version:
<Application>
  <NavigationItems>
    <Items>
      <Item Id="Default">
        <Items>
          <Item Id="CustomForm" CustomFormPath="Controls/WebCustomForm.aspx" />
        </Items>
      </Item>
    </Items>
  </NavigationItems>
  <Views>
    <DashboardView Id="StandardFormWithCustomUserControl">
      <Items>
        <CustomUserControlViewItem Id="CustomUserControlViewItem" CustomControlPath="Controls/WebCustomUserControl.ascx" />
      </Items>
    </DashboardView>
  </Views>
</Application>

Hope this helps.

Cheers

Carl

Added By: Daniele M at: 2/3/2015 1:43:31 AM    

is it possible to call this windows by action and pass it an object id?
if yes, how can I do?

Added By: Dennis (DevExpress Support) at: 2/3/2015 1:54:50 AM    @Deniele: Sure, that is possible. Check out the following product documentation to learn more on how to implement these tasks:
eXpressApp Framework > Task-Based Help > How to: Access Objects Selected in the Current View
eXpressApp Framework > Concepts > Extend Functionality > Show a Window via an Action
View.Tag Property
Please create a separate ticket in the Support Center and attach your test project if you experience any implementation difficulties.Added By: Farooq at: 4/13/2015 11:39:25 PM    

Hi,

Could you please provide the sample project in VB as well. It is difficult to reproduce the project by the below VB code.

Added By: Farooq at: 4/14/2015 12:10:00 AM    

I get an error in WinShowCustomFormWindowController controller when executing

Dim form As Form = TryCast(DevExpress.Persistent.Base.ReflectionHelper.CreateObject(customFormTypeName), Form)

The error says: "Unable to cast object of type 'ModelNavigationItem' to type 'Solution3.Module.Win.IModelWinCustomFormPathNavigationItem'."

Added By: Dennis (DevExpress Support) at: 4/14/2015 4:00:07 AM    

@MohammedFarooq: There is already a VB.NET version of this example here. Please scroll to the bottom and select your programming language in the drop-down box and then click the Downloads | Example link at the top right.
To avoid the error you received, it is important to follow the instructions from the 6th point.

How to display detail collections with descendants filtered by an object type

$
0
0

Suppose we have the same classes structure as shown in the How to: Use UpCasting help topic.
Our goal is to provide two details collections into a DetailView that will allow end-users to view objects of the LocalEmployee and ForeignEmployee classes separately in a Department DetailView.
In order to do this, we will declare two calculated details collections in the Department class and also write some code to update these collections when objects are added in or deleted from the main (associated) Employees collections.
By design the Employees collection is intended to list both local and foreign employees and also to allow end-users to perform any operations with them. The LocalEmployees and ForeignEmployees collections are intended to view objects only. So, the corresponding nested ListViews will be readonly.

See Also:
How to: Set Relationships Between Objects
How to: Calculate a Property Value Based on Values from a Detail Collection
How to filter persistent objects against their type
Collection properties and the New/Delete/Link/Unlink Actions

Question Comments

Added By: Willem de Vries at: 9/12/2012 11:36:40 AM    

I'm curious why HintCollection is used despite the documentation stating:
HintCollection - This member supports the .NET Framework infrastructure and cannot be used directly from your code.

Added By: Dennis (DevExpress Support) at: 3/11/2013 2:08:29 AM    

The HintCollection property is used here to specify a data source for an XPCollection.

Added By: Randy Jean at: 12/5/2014 11:07:54 AM    

Is there any way for these descendant collections to not be read-only?  Or, at the very least, when the list view is clicked the detailview is not read-only?  

Also, on the top-level listview (not filtered) can the New button be set to always drop down the list of objects?  Users are complaining that they hit the "button" part of the New and they don't realize there are different objects to choose to add.

Added By: Dennis (DevExpress Support) at: 12/8/2014 4:48:01 AM    >>Is there any way for these descendant collections to not be read-only?  Or, at the very least, when the list view is clicked the detailview is not read-only?  

You can try to remove the following attribute from these auxiliary collections, though I have not tested this particular configuration when creating this example solution:

[ModelDefault("AllowEdit", "False")]

 In general, it is better to use separate Views for editing these collections; e.g., show an editable ListView via a command on the toolbar.



>>Also, on the top-level listview (not filtered) can the New button be set to always drop down the list of objects?
Yes, set the IModelAction.ShowItemsOnClick Property for the New Action via the Model Editor.Added By: Wojciech at: 9/8/2017 1:30:17 AM    I try to make editable descendant collections, change attribute [ModelDefault("AllowEdit", "True")]. The new button is visible but records are not stored after add.
When adding records from common listview, the descendant collections not refresh.
How to fix it ?
Added By: Michael (DevExpress Support) at: 9/8/2017 8:18:56 AM    

@Wojciech: We intentionally disabled these operations because the built-in New, Link and Unlink actions are not designed to work with collections that do not participate in relationships.

>>>The new button is visible but records are not stored after add.

In fact, the New action in the LocalEmployees and ForeignEmployees tabs creates objects, but it doesn't link them with the parent. You can create a controller for the nested list view that will subscribe to the NewObjectViewController.ObjectCreated event to initialize the new object, and then to the IObjectSpace.Committed event of the new object's detail view to add it to the collection.

>>>When adding records from common listview, the descendant collections not refresh.

You can subscribe to the XPCollection.CollectionChanged event to update filtered collections as required.


How to prevent a DetailView from being shown for a ListView record

$
0
0

Scenario

For certain data forms, a developer needs to limit end-users to editing only through the ListView, i.e. without invoking a separate DetailView.  This is usually done by activating the inline editing and MasterDetailMode = ListViewAndDetailView features as described at eXpressApp Framework > Concepts > UI Construction > Views > List View Edit Modes. More real user scenarios are described in this Support Center thread.


For more convenience and flexibility, the following Model Editor extensions are implemented in the example to control this behavior:
 - The DefaultShowDetailViewFromListView  property at the Views node level allows you to control this functionality globally per application via the Model Editor;
 - The ShowDetailView property at the Views | ListView node level allows you to customize only certain List Views via the Model Editor;




Steps to implement

1. Copy the WinWebSolution.Module\ShowDetailViewFromListViewController.xx file into the YourSolutionName.Module project and rebuild it.

The process of opening a DetailView by double clicking/pressing the Enter key on a record selected in a ListView is managed by the standard DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController class and its ProcessCurrentObjectAction (we can disable this Action to accomplish our task). For more information, refer to the following help topics:
    Concepts > Application Model > Extend and Customize the Application Model in Code
    eXpressApp Framework > Concepts > Application Model > Access the Application Model in Code
    ActionBase.Enabled Property

2. For testing purposes, invoke the Model Editor and set the DefaultShowDetailViewFromListView or ShowDetailView properties for the Views or Views | YourObjetType_ListView nodes to False and run the test app to see that a required ListView no longer opens a DetailView in the aforementioned scenario.

Note
We added some optimizations intended to improve the DetailView opening performance. This optimization depends on the default behavior - the ListView item click opens a DetailView. We suggest that you disable this optimization if you suppress DetailView opening to avoid issues. To disable the optimization, add the following code to the App_Start event handler:

DevExpress.ExpressApp.Web.WebApplication.OptimizationSettings.AllowFastProcessListViewRecordActions = false;

 


IMPORTANT NOTES
This article covers only the case when a DetailView is shown from the ListView after a User double clicks/presses the enter key on a record. Other scenarios should be handled separately by extending the code of this controller. For example, if you do not want to show a DetailView after a new object is created via the New Action, you can handle the NewObjectViewController.ObjectCreating event and set its ObjectCreatingEventArgs.ShowDetailView property to False. However, this is outside the purpose of this article.

Question Comments

Added By: John01 at: 12/2/2015 6:18:00 PM    

This is such as useful feature that it should be part of standard XAF.

Added By: Dennis (DevExpress Support) at: 12/2/2015 11:48:15 PM    Thanks for your feedback. Our team will take it into account (S34026).Added By: Peter Kieslinger at: 12/19/2017 10:15:01 AM    Hi Dennis,

I tried this solution in web without success.
How can this be done in web?

My current Xaf version is 17.2.3
Added By: Michael (DevExpress Support) at: 12/20/2017 6:02:40 AM    @Peter: I just tested the Web part of this example with the current version of our libraries (17.2.4) and can confirm that the solution works as expected. If you have difficulty implementing it in your project, please submit a new ticket and attach the project demonstrating your attempts.

OBSOLETE - How to raise XAF callbacks from client-side events and process them on the server?

$
0
0

============================================================
This example is now obsolete. Refer to the How to: Raise XAF Callbacks from Client-Side Events and Process these Callbacks on Server topic for more details.
============================================================

Scenario:

It is necessary to execute server-side code that requires refreshing the current View as a response to user actions in an ASP.NET application. For example, show the first navigation item when a new navigation group is selected.

Steps to Implement:

1. Create a Controller that implements the IXafCallbackHandler interface. This interface allows defining server-side code that is executed when an XAF callback is raised.
2. Place the required server-side code to the IXafCallbackHandler.ProcessAction method, e.g. change ShowNavigationItemAction's selected item.
3. Subscribe to the Window.ProcessActionContainer event to access a navigation control (NavigationTabsActionContainer).
4. Raise an XAF callback by passing javascript generated by the XafCallbackManager.GetScript method to the NavigationTabsActionContainer.PageControl.ClientSideEvents.ActiveTabChanged event handler.
5. Register your callback handler (Controller) using the XafCallbackManager.RegisterHandler method.

See also:
How to implement the drill-down functionality in Web PivotGrid (ASPxPivotGrid)
How to automatically refresh data in a View after a certain period of time on the Web
Task-Based Help > How to: Open a Detail View When the Grid Row is Clicked in the Dashboard

How to access a nested ListView from the parent DetailView's controller and vice versa

$
0
0

Update: Approaches from this example are now described in the How to: Access Master Detail View and Nested List View Environment topic. Refer to it for a more detailed description.

This example is based on the following facts:


1. The nested ListView is shown in the parent DetailView via the ListPropertyEditor. The ListPropertyEditor class has the Frame property that returns the nested frame and the ListView property that returns the nested ListView. To get the ListPropertyEditor, use the DetailView.FindItem or DetailView.GetItems method.


2. The nested list view's frame is represented by the NestedFrame class that has the ViewItem property, which returns the ListPropertyEditor from the parent DetailView. It is possible to access the parent DetailView via the ListPropertyEditor's View property.


Note that this code is required only if you need to access views and frames. If you need to access child business objects from the parent DetailView, simply get the DetailView's CurrentObject, cast it to the corresponding type and use its collection property. If you need to access the parent object from the nested ListView, use the PropertyCollectionSource.MasterObject property, as shown in the How to: Access the Master Object from a Nested List View help topic.

Question Comments

Added By: Krzysztof Krzyzsłof at: 7/10/2014 1:10:39 AM    

Works in both WIN and WEB.

How to use a custom Lookup Property Editor control for reference properties in WinForms

$
0
0

How to use a custom Lookup Property Editor control for reference properties in WinForms

FEATURES

LookupPropertyEditorEx This is a regular XAF PropertyEditor class that can be used for referenced properties instead of the standard LookupPropertyEditor in Windows Forms applications. By default, this editor allows you to choose a value from the drop down list. It's possible to find the required record in the drop down list by typing text (auto-incremental search). If you want to clear a value, use either the Control+Delete keystroke or click the minus (-) button. If you want to add a new object, click the plus (+) button. It will show a modal DetailView allowing you to fill object properties and save it.

IMPORTANT NOTES

From this example, you need use only one assembly (the WinSolution from the example is just a demo application, and it has no relation to the solution): Editors.Win.dll Since this is a regular XAF module, you should add this module to your application to be able to use its features. In case of standard modules, you add them from the Toolbox via the Application or Module designer. Since we deal with a custom module, you should add this into the Toolbox manually. Please refer to the How to: Add Items to the Toolbox article in MSDN, for more details. Alternatively, you can take the source code and include it in your solution.

The LookupPropertyEditorEx is set as default for all lookup properties in the application. If you want to change this, then invoke the Model Editor for the Windows Forms application project or module, and change the EditorType property of the DetailViewItems | PropertyEditors | LookupProperty node. Or, change the PropertyEditorType property for a class member, ListView column or DetailView item nodes individually.

See Also:

Implement Custom Property Editors 
PropertyEditors.Lookup - How to provide alternative data representations for reference lookup properties (e.g., a simple drop-down box, a complex multi-column grid, or a tree view)

Question Comments

Added By: Carlitos at: 8/18/2012 7:29:01 AM    

I'm not able to see E1101. When I try it says: You can't view this question because it is marked as private.

Added By: Gustavo Marzioni at: 8/27/2012 2:45:42 PM    

it doesn't work when you create several hundred of Demolookup objects

Added By: ASM at: 9/11/2012 10:30:56 PM    

E1101 is still marked as private...

Added By: Jeffrey E at: 12/13/2015 3:50:53 AM    

Hi Support,

I tried this example, but I noticed that when I input in the lookupedit for instance I input letter P, instead letter N appeared. Please see the screenshot - http://screencast-o-matic.com/watch/colIXChv40. I want to make the lookupedit a search text, I removed the arrow button then autofilter.

Thanks.

Added By: Dennis (DevExpress Support) at: 12/14/2015 4:59:41 AM    

@Jeffrey: To process your recent post more efficiently, I created a separate ticket on your behalf: T324200: E1101 auto-filter behavior.

Added By: Michael Bogaerts at: 12/14/2015 11:43:50 PM    

Dennis,
Is it hidden for a particular reason?

Added By: Dennis (DevExpress Support) at: 12/15/2015 12:29:51 AM    @Michael: Yes.

How to populate GridControl using UnboundDataSource (UnboundSource)

Viewing all 7205 articles
Browse latest View live


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