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

How to display a custom control over the worksheet cell

$
0
0

This example demonstrates how to use the SpreadsheetControl.GetCellBounds method to display the ComboBox control over a worksheet cell preventing end-users from entering a wrong value in a cell. Each time an end-user clicks a cell in a particular column, the ComboBox appears, allowing the user to select one of the predefined values.
For implementation details, refer to the How to: Display a Custom Control over the Worksheet Cell article. 

Question Comments

Added By: Joe Sherwood 1 at: 1/7/2016 11:25:47 AM    

How can I do this in ASP.NET Spreadsheet?

Added By: Andrey (DevExpress Support) at: 1/8/2016 12:50:21 AM    

Hello,
To process your recent post more efficiently, I created a separate ticket on your behalf: T331857: How to use the approach described in the 'How to display a custom control over the worksheet cell' example for ASPxSpreadsheet. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.


GridView - How to implement client-side unobtrusive validation using a custom attribute

$
0
0

Updated: 

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

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


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

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

How to override commands in the End-User Designer (custom saving)

$
0
0

This example demonstrates how to override and customize saving in the End-User Designer. This can be useful, for example, if all the reports in a project should be stored in a database, and are retrieved from the database via a stream, and all of this should be done automatically, without forcing an end-user to do anything but click the Save (or Save As) toolbar button.

For a more complex approach on saving reports in an End-User Designer, see Report Storage for the End-User Report Designer.

In this example, a report will also be automatically saved using the custom saving procedure when an end-user closes the Report Designer.

To implement this task, handle the ReportCommand.SaveFile and ReportCommand.SaveFileAs commands. Note that to prevent the standard saving procedure from being called, you just need to enable the handled property.

Question Comments

Added By: Gerard D'Rozario at: 1/31/2014 1:52:51 PM    

Why is this project only compatible with VS 2012+ ?

Added By: Jairo Marques at: 1/7/2016 5:21:21 PM    

Is there a sample project to do the same thing using ASP.Net? I would like to change some behavior for commands and hide others.

Added By: Vasily (DevExpress Support) at: 1/8/2016 2:30:06 AM    

Hello Jairo,

To process your recent post more efficiently, I created a separate ticket on your behalf: T331919: Web Report Designer - How to override/hide commands. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to save the currently opened View as a new View Variant at runtime

$
0
0

This example provides reusable UserViewVariants modules that allow your end-users to add View Variants dynamically. Refer to the Best practices of creating reusable XAF modules by example of a View Variants module extension blog post for more information. See functional tests for the implemented functionality in the UserViewVariants\Functional Tests\E2813.ets file.


IMPORTANT NOTES
Due to the application model generation specifics on the Web it makes sense to use this solution on the Web only if you store your end-user model differences in the database: How to store users' model differences separately for each user in the database.


See also:

ViewVariants - provide the capability to save the current view as a new view variant and share it with other users at runtime

Question Comments

Added By: Robert Fuchs at: 9/2/2013 1:36:24 PM    

Modified today but still not for 13.1 !?
Why?

Added By: Dennis (DevExpress Support) at: 9/3/2013 12:16:43 AM    

Robert, this example was already available for version 13.1 before today. Today was just a maintenance update without much changes.

Added By: Robert Fuchs at: 9/3/2013 10:12:12 AM    

Thanks Dennis.
Interestingly the version combo didn't show 13.1 yesterday.
I downloaded it anyway and it worked in 13.1 after changing .Net FW type to 4.

Added By: Richard Jones_1 at: 12/11/2013 1:04:47 PM    

Hello, This is a great solution, but after upgrading to 13.2 it does not compile, Do you have a version for 13.2?
Thanks
Richard

Added By: Nektarios Patelis at: 12/13/2013 12:35:47 AM    

waiting upgrade for 13.2

Added By: Willem de Vries at: 1/8/2014 8:49:14 AM    

Just leaving a comment to be included in any update messages. Waiting for a remedy for this breaking change to be able to upgrade to 13.2 with many of my applications.

Added By: Tony Tadros at: 1/14/2014 9:52:19 AM    

i have a suggestion to support such functionality of of the box

Added By: Stefan Tschiharz at: 1/23/2014 12:38:29 AM    

Could the example be updated to 13.2.6?

Added By: Dennis (DevExpress Support) at: 1/23/2014 12:41:45 AM    

Guys, please refer to my answer in Q554368 (there you can find an updated version + a link to a hot fix build).

Added By: Kanapol W. at: 1/29/2014 7:58:02 AM    

Right now, I have upgrade to v2013 vol 2.5
I use the most update code in "v2013 vol 1.4- v2013 vol1.9" . It get the error.
Would you please update this example to work with the most update version?

Added By: Dennis (DevExpress Support) at: 1/29/2014 8:01:21 AM    

@Kanapol: This example will be updated once the version 13.2.7 is out (in a week or so). In the meantime, please check out my previous comment for a solution. Thanks.

Added By: Tony Tadros at: 12/23/2014 2:35:17 AM    

Hello Devexpress ,

i have a need to use this module with a small change
i want to have 2 types of variants System,UserDefined for the system ones it should prevent users doing any changes on layout
or to discard changes after user closes current view

if i extended the IModelVariant with the property Type {System,User Defined}how to use this property to after

Thanks & Regards
Tony

Added By: Dennis (DevExpress Support) at: 12/23/2014 8:45:51 AM    

@Tony: You can update the availability of the 'editViewVariantItem' and 'removeViewVariantItem' ChoiceActionItem objects of the Action based on your variant type information via the ChoiceActionItem.Active property:

 

This update can be done from within the UpdateUserViewVariantsAction method or on other events as you prefer.
As for discarding changes to a View, handle the View.ModelSaving event and set the Cancel parameter to True depending on your conditions. While we do not have a ready sample or guidelines for this particular customization, do not hesitate to contact us if you experience any difficulties using the XAF API I suggested above.

Added By: PTLab at: 6/29/2015 3:45:52 AM    

Dennis, it's very interesting example, thank you. I tested this solution in my project, that have implementation of storing user model in database. All One user modifications stored in database, but Other user have all One's modifications after login. Whats wrong, and how realy separate changes?

Added By: Dennis (DevExpress Support) at: 6/29/2015 6:31:30 AM    

@PTLab: Thanks for your feedback. To process your recent post more efficiently, I created a separate ticket on your behalf: T261243: E2813 and model differences stored in the database. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Mysoft Systems at: 1/7/2016 8:47:35 AM    

Great Feature

Added By: Dennis (DevExpress Support) at: 1/8/2016 2:34:39 AM    @Mysoft Systems: Thanks for your feedback. Would you please elaborate a bit more on the main functionality you are planning to implement for your project? With that, we can consider updates to this example or our built-in ViewVariants module to suit your business needs better. Thanks in advance.Added By: Paul Kubb at: 1/8/2016 2:39:02 AM    

@Dennis,  May I join that? I have a certain business requirement about this too, which I still have no idea how to go.

Added By: Dennis (DevExpress Support) at: 1/8/2016 2:51:21 AM    

@Paul: Sure, we will be more than happy to learn more on your business requirements as well and support you with technical solutions. It's best to submit this info in a separate ticket as well.
As far as I understand, this is related to ViewVariants - How to show the ChangeVariant Action even for a single View variant where you have left a comment recently.

OBSOLETE - How to show a specific detail view for a selected record in the TreeList when the list view is in the ListViewAndDetailView mode

$
0
0

=======================================
In the current version, you can achieve the same behavior by setting the DetailView and MasterDetailView properties of the ListView model to None in the Model Editor.
=======================================

This example demonstrates how to show a view of the required type for a currently selected node in the tree list editor. By default, it shows the only the detail view of the base class.
This example also illustrates how to customize the New action, to allow you to create new objects of only the selected node object type.

Question Comments

Added By: Willem de Vries at: 10/17/2012 5:37:48 PM    

The default behavior has been changed, when i recall correctly. Leaving MasterDetailView empty results in the application selection the appropriate DetailView for the selected object.

Outlook Inspired Demo Application Created Using Scaffolding Wizards

Hybrid UI Demo Application Created Using Scaffolding Wizards

ASPxCardView - How to implement custom date validation in Batch Edit mode

$
0
0
This example illustrates how to implement custom date validation in Batch Edit mode:
1) The ASPxClientCardView.BatchEditCardValidating event is used to check values on the client.
2) The ASPxCardView.CardValidating event is used to check values on the server.
3) The CardViewBatchEditSettings.AllowValidationOnEndEdit property allows switching between validation modes on the client side. 

If the variation between the HireDate and BirthDate columns is less than 18, input data is considered invalid and data update is not allowed.

ASPxCardView - How to draw company names in an exported document based on the number of products

$
0
0
This example shows you how to draw company names in an exported document based on the number of products. Company names are painted in Green if the product count is greater than 1,000. Otherwise, the company names are painted in Red.

How to: Use the XRSubreport Control with ViewDataSource

How to customize the appearance of a series tooltip

$
0
0

This example demonstrates how to change the appearance of a series tooltip via its template.

To do this, you need to create a System.Windows.DataTemplate object that specifies the appearance of series tooltips and assign it to the Series.ToolTipSeriesTemplate property. In this example, this has been done for the first series.

Note that before the tooltip customization, you need to set the ChartControl.ToolTipEnabled and ToolTipOptions.ShowForSeries properties to trueto show the tooltip for a series.
It is also necessary to specify a display name for each series displayed on the tooltip via the Series.DisplayName property.


Question Comments

Added By: Rajib Banerjee 4 at: 1/11/2016 3:00:04 PM    

If CrosshairEnabled is set to False, Tooltip is not visible. Please modify the example accordingly.

How to clone a persistent object

$
0
0

Scenario

In this example, we create a CloneIXPSimpleObjectHelper class that will be used to clone the provided persistent object. 

Steps to implement

1. Implement the CloneIXPSimpleObjectHelper class as shown in the CloneIXPSimpleObjectHelper.xx file. This class uses persistent object metadata to create a copy of the provided persistent object. 
The Clone method has several constructors that allow you to specify the target Session and determine whether object synchronization is required or not. If the synchronize parameter is set to true, reference properties are only cloned if the reference object does not exist in the target Session. Otherwise, the existing object will be reused and synchronized with the source. Set this property to false if the target Session does not contain an object of the source.

2. Create a Form that will use the ListBox control to display the result of creating and cloning persistent objects. See the code of the Form class in the Form1.xx file.


As a result, the following output will be shown:



See also:
How to get a list of a persistent object's properties
Should I use XPO to transfer data between databases?

Question Comments

Added By: Sigurd Decroos at: 1/8/2013 5:48:41 PM    

There's a little catch with this code. Primary Keys are changed, so it doesn't make a real clone, but a copy. You have to change the code a bit so the primary key gets synced too if needed.

Added By: Mr292 at: 2/16/2013 12:45:27 PM    

I refactored some in order to replicate to different databases as well as to different assemblies in the other database. I came about this requirement because I wanted to remodel my DOM and did not want to have to manually do a lot of data imports.

    public class CloneIXPSimpleObjectHelper
    {
        /// <summary>
        /// A dictionary containing objects from the source session as key and objects from the
        /// target session as values
        /// </summary>
        /// <returns></returns>
        Dictionary<object, object> clonedObjects;
        Session sourceSession;
        UnitOfWork targetSession;

        /// <summary>
        /// Initializes a new instance of the CloneIXPSimpleObjectHelper class.
        /// </summary>
        public CloneIXPSimpleObjectHelper(Session source, UnitOfWork target)
        {
            clonedObjects = new Dictionary<object, object>();
            sourceSession = source;
            targetSession = target;
        }

        /// <summary>
        /// Initializes a new instance of the CloneIXPSimpleObjectHelper class to Clone to Different DB.
        /// </summary>
        public CloneIXPSimpleObjectHelper(Session session, string connstring)
        {
            UnitOfWork NewUOW = new UnitOfWork(
                XpoDefault.GetDataLayer(connstring, DevExpress.Xpo.DB.AutoCreateOption.SchemaAlreadyExists));

            clonedObjects = new Dictionary<object, object>();
            sourceSession = session;
            targetSession = NewUOW;
        }

        /// <summary>
        /// Initializes a new instance of the CloneIXPSimpleObjectHelper class to Clone to Different Assembly / DB.
        /// </summary>
        public CloneIXPSimpleObjectHelper(Session session, string connstring, System.Reflection.Assembly assembly)
        {

            var dict = new ReflectionDictionary();
            foreach (var item in assembly.GetTypes())
            {
                    if (item.IsSubclassOf(typeof(XPBaseObject)))
                        dict.CollectClassInfos(item);
            }
    
            UnitOfWork NewUOW = new UnitOfWork(
                XpoDefault.GetDataLayer(connstring, dict,
                DevExpress.Xpo.DB.AutoCreateOption.SchemaAlreadyExists));

            clonedObjects = new Dictionary<object, object>();
            sourceSession = session;
            targetSession = NewUOW;

        }

        public void Commit()
        {
            targetSession.CommitTransaction();
           
        }

        public T Clone<T>(T source) where T : IXPSimpleObject
        {
            return Clone<T>(source, targetSession, CloneMethod.IgnoreIfExistsInDesitnation);
        }
        public T Clone<T>(T source, CloneMethod sync) where T : IXPSimpleObject
        {
            return (T)Clone(source as IXPSimpleObject, targetSession, sync);
        }

        public object Clone(IXPSimpleObject source)
        {
            return Clone(source, targetSession, CloneMethod.IgnoreIfExistsInDesitnation);
        }
        public object Clone(IXPSimpleObject source, CloneMethod sync)
        {
            return Clone(source as IXPSimpleObject, targetSession, sync);
        }
        public object Clone(IXPSimpleObject source, Session targetSession, CloneMethod sync)
        {
            return Clone(source as IXPSimpleObject, targetSession, sync);
        }
        public T Clone<T>(T source, UnitOfWork targetSession, CloneMethod sync) where T : IXPSimpleObject
        {
            return (T)Clone(source as IXPSimpleObject, targetSession, sync);
        }
        public object Clone(XPBaseObject obj, Type targetType, CloneMethod sync)
        {
            return Clone(obj, targetSession, targetSession.GetClassInfo(targetType), sync);
        }

        public enum CloneMethod
        {
            TransferOnly,
            Synchronize,
            IgnoreIfExistsInDesitnation
        }
     /// <summary>
        /// Clones and / or synchronizes the given IXPSimpleObject.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="targetSession"></param>
        /// <param name="synchronize">If set to true, reference properties are only cloned in case
        /// the reference object does not exist in the targetsession. Otherwise the exising object will be
        /// reused and synchronized with the source. Set this property to false when knowing at forehand
        /// that the targetSession will not contain any of the objects of the source.</param>
        /// <returns></returns>
        public object Clone(IXPSimpleObject source, UnitOfWork parentSession, XPClassInfo cloneClassInfo, CloneMethod sync)
        {
            if (source == null)
                return null;

            object sourceKey = source.Session.GetKeyValue(source);

            if (clonedObjects.ContainsKey(source))
                return parentSession.GetObjectByKey(cloneClassInfo,cloneClassInfo.KeyProperty.GetValue(clonedObjects[source]));

            
            NestedUnitOfWork nestedSession = parentSession.BeginNestedUnitOfWork();
            IXPSimpleObject clone = null;

            if (sync != CloneMethod.TransferOnly)
            {
                clone = (IXPSimpleObject)nestedSession.GetObjectByKey(cloneClassInfo, sourceKey);
                if (clone != null)
                {
                    if (sync == CloneMethod.IgnoreIfExistsInDesitnation)
                    {
                        clonedObjects.Add(source, clone);
                        return nestedSession.GetParentObject(clone);
                    }
                }
            }

            if (clone == null)
                clone = (IXPSimpleObject)cloneClassInfo.CreateNewObject(nestedSession);
      
            clonedObjects.Add(source, clone);

            try
            {
                XPClassInfo sourceClassInfo = source.Session.GetClassInfo(source.GetType());
                if (sourceClassInfo.KeyProperty.GetType() == cloneClassInfo.KeyProperty.GetType())
                    cloneClassInfo.KeyProperty.SetValue(clone, sourceKey);

                foreach (XPMemberInfo cloneMember in cloneClassInfo.PersistentProperties)
                {
                    XPMemberInfo sourceMem = sourceClassInfo.GetMember(cloneMember.Name);

                    if (sourceMem == null
                        || cloneMember is DevExpress.Xpo.Metadata.Helpers.ServiceField
                        || cloneMember.IsKey)
                        continue;

                    object val = null;
   
                    if (cloneMember.ReferenceType != null)
                    {
                        object createdByClone = cloneMember.GetValue(clone);
                        if (createdByClone != null)
                        {
                           
                            val = Clone((IXPSimpleObject)sourceMem.GetValue(source),
                                nestedSession,
                                nestedSession.GetClassInfo(cloneMember.MemberType),
                                sync==CloneMethod.TransferOnly?CloneMethod.Synchronize:sync);
                        }
                        else
                            if ((cloneMember.IsAggregated)
                                //REMOVE Below LINE IF YOU WANT TO MAINTAIN ONLY ONE WAY AGGREGATIOn
                                || (cloneMember.IsAssociation
                                    && cloneMember.GetAssociatedMember().IsAggregated)
                                )
                            {
                                val = Clone((IXPSimpleObject)sourceMem.GetValue(source), nestedSession,
                                       nestedSession.GetClassInfo(cloneMember.MemberType), sync);
                            }

                    }
                    else
                    {
                            val = sourceMem.GetValue(source);
                    }

                    if ((val != null) && !(val is DateTime && (DateTime)val == DateTime.MinValue))
                        cloneMember.SetValue(clone, val);
                }

                foreach (XPMemberInfo m in cloneClassInfo.CollectionProperties)
                {
                    if (m.HasAttribute(typeof(AggregatedAttribute)))
                    {
                        XPBaseCollection col = (XPBaseCollection)m.GetValue(clone);
                        XPBaseCollection colSource = (XPBaseCollection)sourceClassInfo.GetMember(m.Name).GetValue(source);

                        foreach (IXPSimpleObject obj in new ArrayList(colSource))
                        {
                            XPClassInfo targetinfo = col.GetObjectClassInfo();
                            col.BaseAdd(
                                Clone(obj, nestedSession,
                                    targetinfo, sync));
                        }
                    }
                }

                nestedSession.CommitTransaction(); //
                clonedObjects[source]= clone;
                return nestedSession.GetParentObject(clone);
            }
            catch
            {
                if (nestedSession.InTransaction)
                    nestedSession.RollbackTransaction();
            }

            return null;
        }

    
    
    }

Added By: Chris D at: 8/4/2015 9:56:17 AM    

Dear,

I face a real problem with your clonehelper. After implementing we recoginized that this helper will not only clone my recordset, it will also clone/create my relations.

So, for example i have a order management where i want to clone one order. But what happened is that the order will be cloned, but the underlying addresses (relation via keys) will be cloned, too. So, after cloning 10 orders, i have 10 times the same address in my address-masterdata ?

Any idea ?

Added By: Chris D at: 8/4/2015 10:50:22 AM    

To avoid creating the underlying record, i changed

If m.ReferenceType IsNot Nothing And NONEW=1 Then....

where NONEW=0.

Could you please have a short look if this is the right solution ?

Added By: Alexey (DevExpress Support) at: 8/4/2015 11:14:43 PM    Hello Chris,
Yes, it is possible to comment this part of code to disable creating of additional records.Added By: Paul Kubb at: 1/11/2016 9:00:47 PM    

Is this equivalent to Extra Clone Module?

Added By: Alexey (DevExpress Support) at: 1/12/2016 3:32:14 AM    

You are correct. While the Clone Object Module is specific for an XAF application, this approach allows implementing the same functionality with XPO in other .NET applications.

How to add support for a new file format

$
0
0

This example demonstrates how you can teach the RichEditControl in your application to open and save files in a custom format. Thanks to the IImporter and IExporter interfaces, this task is rather straightforward, and can be accomplished with ease.

As an example, we'll add support for a well-known format .eml. Files in this format are plain text in MIME standard, so the XtraRichEdit's built-in save and load methods for MHT content can be used. This fact simplifies the implementation, but you can write your own import/export helper classes if required.

First, provide a unique identifier for a new format. It should be a new DocumentFormat enumeration member. Take a value that is large enough to exceed the used range, e.g. 444. Then, create two classes - importer and exporter, and two classes that represent options for import and export.

The class containing options for import should be derived from the DocumentImporterOptions class or its descendants. In our case, it is the EmlDocumentImporterOptions derived from the MhtDocumentImporterOptions.

The class EmlDocumentImporter implements the IImporter<DocumentFormat, bool> interface. The basic functionality is encapsulated in its LoadDocument method. To load a document in .eml format, we simply call the DocumentModel.InternalAPI.LoadDocumentMhtContent method, but for other formats you can use your custom procedures.

The class containing options for export should be derived from the DocumentExporterOptions class or its descendants. In our case, it is the EmlDocumentExporterOptions derived from the MhtDocumentExporterOptions.

The class EmlDocumentImporter implements the IExporter<DocumentFormat, bool> interface. In its SaveDocument method, the DocumentModel.InternalAPI.SaveDocumentMhtContent method is used, but you are free to use a custom procedure instead.

We have all the required objects capable of performing export-import operations. To teach the XtraRichEdit to use our objects for handling .eml files, consider the XtraRichEdit services. Loose coupling provided by the service pattern enables us to easily incorporate the desired functionality into the XtraRichEdit behavior models. The IDocumentImportManagerService has the RegisterImporter method, and the IDocumentExportManagerService has the RegisterExporter method, designed for this purpose. Register our importer and exporter classes, and the RichEditControl is capable of loading and saving files in .eml format.

Note that this example uses objects from the DevExpress.XtraRichEdit.Model and DevExpress.XtraRichEdit.Internal namespaces, not included in the documentation. The DevExpress team does not encourage the use of objects which are not listed in our documentation (help reference), and does not guarantee that these objects will be retained in future versions.

Question Comments

Added By: Luis Sagasta at: 1/12/2016 3:26:26 AM    

Hello.

Please, could you show me how to write my own import/export helper class?
I need to import from a PDF file (the method to convert PDF to RTF is provided by us) and I don't know how to approach into RTF editor.

Thank you and regards.

Added By: Oleg (DevExpress Support) at: 1/12/2016 4:15:44 AM    

Hello Luis,
To process your recent post more efficiently, I created a separate ticket on your behalf: T333104: How to adapt the approach demonstrated in E2291 example to convert a PDF document to RTF format. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to: draw a custom legend marker for a series

$
0
0
This example demonstrates one of possible ways to use the CustomDrawSeries event. In this sample the event is used to modify the legend markers of bar series.

How to insert an image from a database into ASPxHtmlEditor by using ImageSelector

$
0
0

This example illustrates how to insert an image stored in a database into the ASPxHtmlEditor form by using ImageSelector.

ASPxHtmlEditor does not have a built-in capability to show binary data stored in a database. Therefore, it is necessary to define a custom handler, which dynamically gets an image from the database and sends it to the user as the handler's response . For this purpose the ASHX generic handler is used. You can learn more about HTTP Handlers here: HTTP Handlers and HTTP Modules Overview.

In the current example images are inserted into the ASPxHtmlEditor form via ImageSelector in the following format:

[ASPx]
<imgsrc="Image.ashx?path=Salvador Dali/1910 - 1927/CrepuscularOldMan.jpg"alt=""/>

 

Update for version 15.1.8 and newer versions

Starting from version 15.1.8, we have added the capability to operate files and folders that are stored in a physical file system, or a database, or cloud services in ASPxHtmlEditor's built-in ASPxFileManager control. 
The ProviderType property is used to specify the type of a storage where a current file system is contained. See the File System Providers Overview topic to learn more. 

To accomplish this task, create your own File System Provider, assign its name to the CustomFileSystemProviderTypeName property and set the ProviderType property to Custom, so the built-in ASPxFileManager control will operate a custom File System Provider.
Use the RootFolderUrlPath property to set the path to an image handler. In this handler, get the image data and write it into Response. 


For older versions:

To accomplish the described task, it is necessary to execute the following steps:

1) Open the SelectImageForm.ascx.cs page;
2) Comment or delete the following code to avoid incorrect RootFolder setting:

[C#]
protectedvoidPrepareFileManager(){//FileManager.Settings.Assign(HtmlEditor.SettingsImageSelector.CommonSettings); //if(string.IsNullOrEmpty(FileManager.Settings.RootFolder)) // FileManager.Settings.RootFolder = HtmlEditor.SettingsImageUpload.UploadImageFolder; ... }

3) Change the FileManager_CustomJSProperties event to set the path to an image handler:

[C#]
protectedvoidFileManager_CustomJSProperties(objectsender,DevExpress.Web.ASPxClasses.CustomJSPropertiesEventArgse){e.Properties["cp_RootFolderRelativePath"]="Image.ashx?path=";}

4) Get an image from a database and show it in the ASPxHtmlEditor form :
  a) Create an image handler (*.ashx );
  b) In this handler, parse Request.QueryString and get an image from a database by using the parsed path;
  c) Write the obtained image into Response.


Parameters - How to create cascading ComboBoxes

OBSOLETE - How to Show a Filtered List View from the Navigation Control

$
0
0

=========================================
This example is now obsolete, because it uses a quite low level API (ModelNodesGeneratorUpdater), which is required in advanced scenarios only. Instead, please implement simpler solutions in code or in the Model Editor:
Navigation System | Define the Navigation Structure
Criteria Property of a List View's Collection Source

Criteria Property in the Application Model 
=========================================

This example demonstrates how to show a filtered List View via a navigation control's item. The "Today's Tasks" navigation item will be added. It is intended to show tasks that should be started today.

For details, refer to the How to: Show a Filtered List View from the Navigation Control topic in XAF documentation.

ASPxCardView – How to export images from a column of the CardViewImageColumn type

ASPxCardView - How to implement a summary whose value depends upon an external editor value

$
0
0
The example below demonstrates how to calculate a summary in the CategoryID column based on the value in the ASPxSpinEdit residing below. Here is how the project works:

1) A custom callback is sent to the server within the editor's client side NumberChanged event handler.
2) Handle the SummaryDisplayText event to calculate the required summary value and set the e.Text parameter.

How to use XtraReport's multi-value parameter as a column chooser

$
0
0

This example demonstrates how to use a report parameter in multi-value mode to grant an end-user the capability to select columns that should be displayed in the report:



LookUpValueCollection is used in the report's class to store a column's filed names (as the Value property) and their captions (as the Description property). Then, this collection is used to assign the LookUp values to the report's column chooser parameter and to get the column caption by its field name. The report's DataSourceDemanded event handler is used to get columns chosen by the end-user and create corresponding cells in the report's XRTable controls (that were created at design time).

Viewing all 7205 articles
Browse latest View live


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