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

How to apply master filtering in MVCxDashboardViewer

$
0
0

The following example demonstrates how to apply master filtering in MVCxDashboardViewer on the client side.


In this example, the ASPxClientDashboardViewer.SetMasterFilter method is used to select required rows in the Grid dashboard item. The SettingsBase.Name property value is used to access the extension client object on the client side.
Click the Grid dashboard item to apply master filtering.


How to export cell range to a DataTable

$
0
0

This example illustrates how you can export worksheet cell range to a System.Data.DataTable object.

The following steps are required:

1) Add a reference to the DevExpress.Docs.v13.2.dll assembly to your project containing the SpreadsheetControl. Note that distribution of this assembly requires a license to the DevExpress Document Server or the DevExpress Universal Subscription.
2) Create the DevExpress.Spreadsheet.Export.DataTableExporter instance using the DevExpress.Spreadsheet.Worksheet.CreateDataTableExporter method.
3) Call the Export method of the DataTableExporter.

You can create an empty DataTable by using the CreateDataTable method of the DataTableExporter. The column names are obtained from headings of the cell range, and the column data types are extracted from cell data types of the first row of a range.
The DataTableExporter contains various options that enables you to specify how cell data are processed before storing them in a DataTable.

Question Comments

Added By: Juan Capiau - D at: 7/29/2014 6:55:38 AM    

I'm trying this example and the 'Export Worksheet Table Using Exporter Options' throws an error (Index was out of range) on Sub barButtonItemUseExporterOptions_ItemClick, line 'Dim range As Range = worksheet.Tables(0).Range'. i've tried multiple files, none work. If i select a range and export that (the 'Export Selected Range to Data Table') there is no problem. How can I fix this ?

System.ArgumentOutOfRangeException was unhandled
 HResult=-2146233086
 Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
 ParamName=index
 Source=mscorlib
 StackTrace:
      at System.ThrowHelper.ThrowArgumentOutOfRangeException()
      at DevExpress.XtraSpreadsheet.API.Native.Implementation.NativeCollectionBase`3.get_Item(Int32 index)
      at ExportToDataTableExample.Form1.barButtonItemUseExporterOptions_ItemClick(Object sender, ItemClickEventArgs e) in C:\Users\JCA\Documents\Samples\XtraSpreadSheet\14.1.5\E4997\ExportToDataTableExample\ExportToDataTableExample\Form1.vb:line 68
      at DevExpress.XtraBars.BarItem.OnClick(BarItemLink link)
      at DevExpress.XtraBars.BarBaseButtonItem.OnClick(BarItemLink link)
      at DevExpress.XtraBars.BarButtonItem.OnClick(BarItemLink link)
      at DevExpress.XtraBars.BarItemLink.OnLinkClick()
      at DevExpress.XtraBars.BarButtonItemLink.OnLinkClick()
      at DevExpress.XtraBars.BarItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
      at DevExpress.XtraBars.BarButtonItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
      at DevExpress.XtraBars.BarItemLink.OnLinkActionCore(BarLinkAction action, Object actionArgs)
      at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.ClickLink(BarItemLink link)
      at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(BarItemLink link)
      at DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnUnPressItem(DXMouseEventArgs e, RibbonHitInfo hitInfo)
      at DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnUnPress(DXMouseEventArgs e, RibbonHitInfo hitInfo)
      at DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnMouseUp(DXMouseEventArgs e)
      at DevExpress.XtraBars.Ribbon.Handler.RibbonHandler.OnMouseUp(DXMouseEventArgs e)
      at DevExpress.XtraBars.Ribbon.RibbonControl.OnMouseUp(MouseEventArgs e)
      at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
      at System.Windows.Forms.Control.WndProc(Message& m)
      at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
      at DevExpress.XtraBars.Ribbon.RibbonControl.WndProc(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
      at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
      at DevExpress.Utils.Win.Hook.ControlWndHook.CallWindowProc(IntPtr pPrevProc, IntPtr hWnd, Int32 message, IntPtr wParam, IntPtr lParam)
      at DevExpress.Utils.Win.Hook.ControlWndHook.WindowProc(IntPtr hWnd, Int32 message, IntPtr wParam, IntPtr lParam)
      at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
      at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
      at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
      at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
      at System.Windows.Forms.Application.Run(Form mainForm)
      at ExportToDataTableExample.Program.Main() in C:\Users\JCA\Documents\Samples\XtraSpreadSheet\14.1.5\E4997\ExportToDataTableExample\ExportToDataTableExample\Program.vb:line 45
      at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
      at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
      at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
      at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Threading.ThreadHelper.ThreadStart()
 InnerException:

Added By: Brian (DevExpress) at: 7/29/2014 7:25:34 AM    Please make sure that the document loaded in the SpreadsheetControl has a table. If it does not, insert a table using the Insert Table command in the Insert ribbon group, or use the Spreadsheet API as described in the How to: Create a Table document.

How to perform a drill-down in MVCxDashboardViewer

$
0
0
The following example demonstrates how to perform a drill-down in MVCxDashboardViewer on the client side.

In this example, the ASPxClientDashboardViewer.PerformDrillDown method is used to perform a drill-down for a specified row in the Grid dashboard item. This method is called in the ASPxClientButton.Click event handler of the button extension.

How to configure dxPanorama

How to: Use the InstanceInitializerAttribute

$
0
0
This example shows how to use InstanceInitializerAttribute to create objects of a class that does not contain the default constructor (without the parameters).

Click the New Client button within the Clients property menu to set a Client class instance as the property's value.

How to process authenticated requests on the OData service

$
0
0

This example demonstrates how to process authenticated requests on the OData service. The main idea is to override the DataService.OnStartProcessingRequest method and implement authenticated logic in it.

To access this service, use the following credentials:

UserName: John
Password: qwerty

See also:
OData and Authentication – Part 6 – Custom Basic Authentication
Salt (cryptography)
How to send authenticated requests to the OData service

Question Comments

Added By: Jay Patel 15 at: 9/24/2013 11:33:27 AM    

I was wondering why this project is not compatible with Visual Studios Ultimate 2010? Thanks

Added By: Joseph Tang 3 at: 10/10/2013 7:57:30 AM    

I used your code with the modification that it would check the AD for authentication. It works. However, it always popup the login window for entering the username and password.

Added By: Pedro Coutinho 1 at: 11/28/2013 3:22:33 AM    

How can i get the userinfo from the database?

Added By: Pedro Coutinho 1 at: 11/29/2013 7:09:31 AM    

How can i retrieve this users from a database?

Added By: George Yoder at: 1/25/2014 1:19:44 PM    

How would you do authentication with sql membership provider????

Added By: Enderson Salas at: 7/29/2014 4:26:35 PM    

This example no compile in  Visual Studio 2013  because some assembly references are missing.

Added By: Nikolai (DevExpress Support) at: 7/30/2014 4:23:50 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T135174: E4403 is not compiled in Visual Studio 2013. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

OBSOLETE - How to implement a controller that will work for more than one target object type (Example)

$
0
0

========================

To make a single ViewController or Action available in Views of different business object types simultaneously, set the TargetObjectType property in code to an interface or their base class type, which is implemented or inherited by all these business types respectively.  Alternatively, for the same task, you can specify several View identifiers via the TargetViewId property.

========================

See the How to implement a controller that will work for more than one target object type KB Article for a complete description.

Question Comments

Added By: rushdan . at: 7/29/2014 10:39:37 PM    

error when click run online.

ps: I dont how to paste or attach  the print screen.

Added By: Dennis (DevExpress Support) at: 7/30/2014 9:07:13 AM    @rushdan: Thank you for your feedback. We will move the information from this article into our documentation. I have updated the description accordingly.

How to implement touch scrolling in GridView

$
0
0

This example demonstrates how to provide the capability to scroll GridView by dragging its rows to be able to use GridView on touch devices. The helper class implements a basic scrolling behavior and some type of inertial scrolling when you drag a row fast. You can modify the helper class logic based on your application requirements. In addition, in this example we created a custom GridView which allows you to increase the scrollbar's width to adapt it for touch scrolling. If you do not need this functionality in your real application, it is not necessary to use a custom View. Just copy the helper class to your application.

This example is outdated

In the latest version of our components, GridControl supports touch scrolling out of the box. So, you don't need to add any helper or change any property. This helper was created when this functionality was not supported by default. You can utilize the helper class from this example in case you are using an older version of our components or, for example, want to implement custom touch scrolling behavior.



Question Comments

Added By: John Nicol_1 at: 7/30/2014 6:07:48 PM    

can you inform us which version started supporting xtraGrid support without the need of the help class?

Added By: Jannet (DevExpress Support) at: 7/31/2014 12:28:10 AM    Hello John,
Touch support in GridControl was introduced starting with version 11.2. See the following ticket in confirmation of this:
XtraGrid - Provide Touch Screen Scrolling like IPhone Does

How to use a stored procedure with parameters as a report data source in a WinForms application

$
0
0

The simplest method to use a stored procedure with parameters as a report data source is to create a corresponding TableAdapter in the VS DataSet designer.

To avoid the "Expected parameter was not supplied" error, when using parameterized stored procedure, please make certain whether the corresponding TableAdapter is detached from the XtraReport.DataAdapter property and the necessary parameter value is manually provided. You can use the Report Parameters for this purpose. Finally, fill the report's data source in the XtraReport.BeforePrint event handler by the TableAdapter.Fill() method call.

How to: Apply Conditional Formatting

$
0
0
This example demonstrates how to change the appearance of individual cells based on specific conditions using the Conditional Formatting feature.

How to implement data editing with hidden column

$
0
0

Problem:

I need to hide some columns in the GridView because they are utilized for internal purpose (e.g., rowversion column). At the same time, it is necessary to have these column values in the update action method specified via the MVCxGridViewEditingSettings.UpdateRowRouteValues Property. Currently, the corresponding values are empty.

Solution:

This issue occurs because the generated HTML does not contain INPUT fields that correspond to hidden columns. For this reason, when data is posted to the server, the corresponding model fields are left empty (the model binding mechanism cannot find appropriate values for these fields). To solve this problem, you can use the approach from the Passing Values to Controller Action Through Callbacks help section to forcibly pass the required values to the update action method. In addition to the MVCxClientGridView.BeginCallback Event, you need to handle the GridViewSettings.CustomJSProperties Event to pass the currently edited row values to the client side.

Note:

If it is OK for you to show the caption and editor of the hidden column in the Edit Form, you can use a much simpler solution. Just set the GridColumnEditFormSettings.Visible property to true. This approach might be useful when you are hiding columns via the Customization Window.

How to clone a persistent object

$
0
0

This is an example for the How to clone a persistent object Knowledge Base article. Please refer to the article for the explanation.

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;
        }

    
    
    }

How to implement dependent views in a DashboardView (filter based on selection)

$
0
0

This example illustrates how to filter a ListView displayed in a DashboardView based on another ListView's selection.

Scenario
When a DashboardView contains several list views, it is often required to make them dependent, e.g. display items of one ListView based on items or selection of another ListView.

Steps to implement
1. Add a new ViewController to your platform-agnostic module (DashboardFilterController).
2. In the OnActivated method retrieve the necessary DashboardViewItems via the FindItem method. After that subscribe to the ControlCreated event of the DashboardViewItem whose ListView will be used for filtering (hereinafter referred to as SourceView).
3. In the ControlCreated event handler retrieve the SourceView via the DashboardViewItem.InnerView property and subscribe to its SelectionChanged event.
4. In the SelectionChanged event handler retrieve the View that will be filtered (hereinafter referred to as TargetView) in the same manner as in the previous step.
5. To retrieve an object by which filtering will be performed, use the ListView.CurrentObject property. This object must be loaded from SourceView ObjectSpace to TargetView ObjectSpace via the GetObject method.
6. Now you can simply filter the TargetView by adding CriteriaOperator to the TargetView.CollectionSource.Criteria dictionary. In my example, I created a simple InOperator to filter the Position column via objects from SourceView.

Important notes:
The provided algorithm is platform-agnostic. It will work without any additional code in WinForms applications, but in ASP.NET the TargetView will not be refreshed immediately after changing the SourceView's selection. It is required to post changes made on the server side to the client to show them in the browser. That is why I have implemented the DashboardViewRefreshController that will refresh DashboardView when selection in the SourceView is changed. Handle the WebWindow.CurrentRequestWindow.PagePreRender event. In this event handler, find the ASPxGridView, modify its client-side SelectionChanged event and the script using the CallbackManager as shown in the DashboardRefreshController.cs file.
Then deactivate the RecordsNavigationController to prevent its activation for the TargetView in the DashboardView. This controller can lead to an exception during navigation to the record's DetailView on a click in the SourceView. This behavior is caused by the fact that RecordsNavigationController lies inside the ListView and collects information about records when this ListView is disposed of. It collects records based on visible rows, but since we filter the CollectionSource, it does not contain the required object.

Question Comments

Added By: Bram Essers at: 3/6/2014 1:12:31 AM    

Hi,
Thanks for this clear example. Together with the supplied source code it is easy to follow. I do have a question. I was testing the functionality in the Web Application solution. When I change the selection in the source grid via the check boxes everything works fine. However, when I click on a row in the source grid I get an exception (see below). What can be done to fix this issue?

Regards,
Bram

The error occurred:

     Type: ObjectDisposedException
     Message: Cannot access a disposed object.
Object name: 'DevExpress.ExpressApp.NestedFrame'.
     Data: 0 entries
     Stack trace:

   at DevExpress.ExpressApp.Frame.CheckIsDisposed()
   at DevExpress.ExpressApp.Frame.SetTemplate(IFrameTemplate val)
   at DevExpress.ExpressApp.Editors.DashboardViewItem.BreakLinksToControl(Boolean unwireEventsOnly)
   at DevExpress.ExpressApp.CompositeView.BreakLinksToControls()
   at DevExpress.ExpressApp.View.b__2()
   at DevExpress.Persistent.Base.SafeExecutor.Execute(Method method, Object targetObject, String targetObjectIdentifier)
   at DevExpress.ExpressApp.View.Dispose()
   at DevExpress.ExpressApp.Frame.DisposeView(View view)
   at DevExpress.ExpressApp.Frame.SetView(View view, Boolean updateControllers, Frame sourceFrame)
     InnerException is null

Added By: Alexey (DevExpress Support) at: 3/6/2014 1:39:56 AM    

Hello Bram,
I will answer you in the Q467603 thread

How to edit a persistent object on a Web page

$
0
0

==================================================
This article is now obsolete.
Use the approach from Tutorial 5 - An ASP .NET Application for Data Editing to edit persistent objects by using the ASPxGridView control.
================================================== 

This example uses the FormView component, which is bound to XpoDataSource with a single object in it. The XpoDataSource is filtered by the Oid key. A QueryString field supplies a value for the criteria parameter.

A local SQL Server is required to launch the example. You should run the DatabaseUpdater project first to create a database and fill it with data. Then set XpoWebApplication as a startup project and launch it. Data is displayed in the ASPxGridView. When the Edit link is clicked, a new page with the FormView is open for object editing.

See Also:
How to use XPO in an ASP.NET (Web) application

ASPxHtmlEditor - How to embed Header and Footer to exported document

$
0
0

This example demonstrates how to embed header and footer to an exported document when using the ASPxHtmlEditor.
This functionality is implemented using the RichEditDocumentServer control and the XtraPrinting Library functionality. 


How to use the XPPageSelector with the GridControl

$
0
0

This example demonstrates how to bind the XtraGrid to the XPPageSelector component. Please note that paging is not applicable to the XtraGrid, as the grid requires the entire collection to correctly apply any sorting, grouping or filtering. Therefore, grouping, sorting and filtering will only be applied to the current page when the grid is bound to the XPPageSelector component. We advise that you use the Server Mode feature instead.

Question Comments

Added By: Vikas Gupta 7 at: 11/28/2012 3:24:44 PM    

Thanks for the code - but it's not working for me - I have tables with Schema for ex: Business.Files
In the class I am using
namespace ForeSight.Business
{
    public class Files : XPLiteObject
    {
         int fFileID;
        [Key(true)]
        public int FileID
        {
            get { return FileID; }
            set { SetPropertyValue<int>("FileID", ref fFileID, value); }
        }
        ... and more fields
     }
        public Files(Session session) : base(session) { }
        public Files() : base(Session.DefaultSession) { }
        public override void AfterConstruction() { base.AfterConstruction(); }
}

I am setting up the xpoDefault connectionstring by
XpoDefault.ConnectionString = MSSqlConnectionProvider.GetConnectionString(@"localhost\sqlexpress", "DatabaseName");
The application runs but
The problem is each time it runs it creates a new table name in the database named dbo.Files (which obviously is empty) thus shows nothing....

I got your example application and created a similar application and verified the code - but found nothing abnormalities...

What am i doing wrong?
let me know if can get you more information thanks

How to localize dxDateBox

$
0
0
This example illustrates how to localize dxDateBox day and month names and a date format. This example uses the German culture from the globalize culture libraries. 

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

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

- Define an external filter editor (for example, the ButtonEdit with a single button);
- Handle the client-side ASPxClientButtonEdit.ButtonClick event;
- Perform a custom GridView callback via the client-side ASPxClientGridView.PerformCallback method;
- Pass the editor's value as a parameter;
- Handle the GridViewSettings.CustomActionRouteValues.Action method and retrieve the passed parameter. In general, it is possible to use the Action method specified for all GridView callbacks (GridViewSettings.CallbackRouteValues.Action). The illustrated technique allows handling a custom GridView's callback within a separate Action method, whose signature can be different. Usually, custom callbacks are used for changing the GridView's state programmatically in a custom manner;
- Pass the retrieved value to the GridView's PartialView via the ViewData key;
- Handle the GridViewSettings.BeforeGetCallbackResult event: if the ViewData key exists, iterate trough GridView rows and select the required one via the MVCxGridView.Selection API.

How to create custom report controls

$
0
0

The following example demonstrates how to create a custom ProgressBar control.

In this example, the progress bar control is implemented as a filled rectangle with variable width, and serves as a graphical representation of a numerical value. This custom control has two primary properties - Position and MaxValue. The Position property determines the current progress for the value tracked by this control (how much of the bar is filled in with the progress color). The MaxValue property determines the maximum value for the Position property and the scale used by the progress bar. Note that the Position property is bindable, which allows the progress bar control to be used in data-aware reports.

Question Comments

Added By: Jignesh Suthar at: 4/18/2013 10:26:52 AM    

How do I specify editor for the Numeric property in below example?

Added By: Wolfgang Lautner at: 7/31/2014 7:02:23 AM    

I tried this example and when changing the base class from XRLabel to XRControl, then also the "Preview" worked (exception unable to cast PanelBrick to LabelBrick)

Then I tried to make a custom control how described in the tutorial "How to: Create a Progress Bar Control", but when loading the DLL to add the control to the toolbox, it failed with the error "There is no components in '...dll' that can be placed on the toolbox.

Any idea what is going wrong or can you provide an example project to build a working control dll?

Regards, Wolfgang

Added By: Vasily (DevExpress Support) at: 7/31/2014 10:31:56 AM    

Hi Wolfgang,

To process your recent post more efficiently, I created a separate ticket on your behalf: T135838: How to create a custom report control and register in in the ToolBox. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

GridView - How to implement an external filter

Viewing all 7205 articles
Browse latest View live


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