Quantcast
Viewing all 7205 articles
Browse latest View live

How to use the LayoutView/CardView as a master View in master-detail mode

This example illustrates how to emulate a master-detail mode for the LayoutView/CardView.

Image may be NSFW.
Clik here to view.

Question Comments

Added By: Marcus Gabriel at: 8/20/2013 11:44:10 AM    

A screenshot how the result looks would help to quickly find out if this sample is what someone is looking for.

Added By: Svetlana (DevExpress Support) at: 8/20/2013 1:05:06 PM    

Hi,

I have added an image showing how the application works. Thank you for your idea.

Added By: Sean Birmingham 1 at: 8/8/2015 5:33:30 PM    

I am attempting a similar solution but the layout view (lvPictures) is itself a detail view (of gvLocation) and I want the detail grid view displayed in the PopupContainerControl to be a view (gvPicTags) I've created in the grid designer that itself uses editors created in the grid designer's In Place Editor Repository to add/update/delete records in gvPicTags.  Is this possible?

I've implemented the solution posted here to display the detail grid but doesn't appear to be picking up the grid layout (gvPicTags) I've created.  It does however display the raw data correctly...

Added By: Sean Birmingham 1 at: 8/8/2015 6:14:13 PM    

Funny, sometimes writing a question helps clarify the solution...

In the lvPictures_GotFocus I execute:

       helper = New MasterDetailHelper(layoutView1, ViewType.Grid, gvPicTags)
       helper.CreateDetail()

LayoutView1 is the sender object (lvPictures) and I added an additional parameter referencing the detail grid view (gvPicTags) which I created in the designer.  In CreateView() I changed the detailView_Renamed assignment for GridView from New GridView(DetailGrid) to the detailGridView (gvPicTags) which I passed via the new parameter.


How to implement CRUD operations using DXGrid with Entity Framework (Instant Feedback)

This example shows how to use EntityInstantFeedbackDataSource with the DXGrid for WPF and perform CRUD operations (add, remove, edit) via Entity Framework.

How to implement CRUD operations using DXGrid and Entity Framework (Server Mode)

This example shows how to use EntityServerModeDataSource with DXGrid, and how to implement CRUD operations (e.g., add, remove, edit) in your application via special behavior.

Note that the test sample requires the SQL Express service to be installed on your machine.

We have created the EntityServerModeCRUDBehavior attached behavior for GridControl. For instance:

[XML]
<dxg:GridControl><dxmvvm:Interaction.Behaviors><crud:EntityServerModeCRUDBehavior...><crud:EntityServerModeCRUDBehavior.DataSource><dxsm:EntityServerModeDataSource.../></crud:EntityServerModeCRUDBehavior.DataSource></crud:EntityServerModeCRUDBehavior></dxmvvm:Interaction.Behaviors></dxg:GridControl>

The EntityServerModeCRUDBehavior class contains the NewRowForm and EditRowForm properties to provide the "Add Row" and "Edit Row" actions. With these properties, you can create the Add and Edit forms according to your requirements:

[XML]
<DataTemplatex:Key="EditRecordTemplate"><StackPanelMargin="8"MinWidth="200"><Grid><Grid.ColumnDefinitions><ColumnDefinition/><ColumnDefinition/></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition/><RowDefinition/></Grid.RowDefinitions><TextBlockText="ID:"VerticalAlignment="Center"Grid.Row="0"Grid.Column="0"Margin="0,0,6,4"/><dxe:TextEditx:Name="txtID"Grid.Row="0"Grid.Column="1"EditValue="{Binding Path=Id, Mode=TwoWay}"Margin="0,0,0,4"/><TextBlockText="Name:"VerticalAlignment="Center"Grid.Row="1"Grid.Column="0"Margin="0,0,6,4"/><dxe:TextEditx:Name="txtCompany"Grid.Row="1"Grid.Column="1"EditValue="{Binding Path=Name, Mode=TwoWay}"Margin="0,0,0,4"/></Grid></StackPanel></DataTemplate><crud:EntityServerModeCRUDBehaviorNewRowForm="{StaticResource ResourceKey=EditRecordTemplate}"EditRowForm="{StaticResource ResourceKey=EditRecordTemplate}"/>

This behavior requires the following information from your data model:

- EntityType - the type of rows;

- ObjectContext - database entities;

- DataSource - an object of the EntityServerModeDataSource type.

[XML]
<crud:EntityServerModeCRUDBehaviorEntityType="{x:Type local:Item}"ObjectContext="{StaticResource ResourceKey=DatabaseEntites}"><crud:EntityServerModeCRUDBehavior.DataSource><dxsm:EntityServerModeDataSourceKeyExpression="Id"QueryableSource="{Binding Items, Source={StaticResource DatabaseEntites}}"/></crud:EntityServerModeCRUDBehavior.DataSource></crud:EntityServerModeCRUDBehavior>

See the EntityServerModeDataSource Class to learn more about EntityServerModeDataSource.


Behavior class descendants support the following commands: NewRowCommand, RemoveRowCommand, EditRowCommand. You can bind your interaction controls with these commands with ease. For instance:

[XML]
<crud:EntityServerModeCRUDBehaviorx:Name="helper"/><StackPanelGrid.Row="1"Orientation="Horizontal"HorizontalAlignment="Center"><ButtonHeight="22"Width="60"Command="{Binding Path=NewRowCommand, ElementName=helper}">Add</Button><ButtonHeight="22"Width="60"Command="{Binding Path=RemoveRowCommand, ElementName=helper}"Margin="6,0,6,0">Remove</Button><ButtonHeight="22"Width="60"Command="{Binding Path=EditRowCommand, ElementName=helper}">Edit</Button></StackPanel>

By default, the EntityServerModeCRUDBehavior solution supports the following end-user interaction capabilities:

1. An end-user can edit selected row values by double-clicking on a grid row or by pressing the Enter key if the AllowKeyDownActions property is True.

2. An end-user can remove selected rows via the Delete key press if the AllowKeyDownActions property is True.

3. An end-user can add new rows, remove and edit them via the NewRowCommand, RemoveRowCommand, and EditRowCommand commands.

Question Comments

Added By: Claire N Streb at: 8/2/2012 6:38:47 AM    

There is a file in this example called Database.mdf that requires SQL Server version 661. My server only supports 655. Can you please provide instructions or more files so that I can run this example?

Added By: Haytham Z. at: 5/3/2015 7:28:42 AM    

Hi devexpress,
Thanks for the sample, but it doesn't work with EF 6. I tried using ((IObjectContextAdapter)my_context).ObjectContext in order to convert it to ObjectContext, but without success.
Any help please?

Added By: Ivan (DevExpress Support) at: 5/4/2015 2:05:03 AM    Hi Haytham,

I have extracted your question into a separate ticket - T237245. Let's continue our discussion there.

Added By: Mikhail Shubin at: 5/4/2015 2:33:32 AM    

Hi Ivan,
It seems the ticket T237245 is a private one. Please make it public.

Added By: Ivan (DevExpress Support) at: 5/4/2015 7:01:25 AM    

Hi Mikhail,
I have decided to create a new public ticket on your behalf and post the solution there - How to upgrade E3863 to make it work with EF6. Please refer to it for more information.

Added By: Pierre Tremblay at: 5/4/2015 3:42:52 PM    

I will also be interested to see the new ticket "How to upgrade E3863 to make it work with EF6".

Is there any plan to make that Behavior part of your MVVM framework?

Added By: Ivan (DevExpress Support) at: 5/5/2015 12:32:23 AM    

Hi Pierre,
We don't have immediate plans to add this class to our MVVM framework.
I have marked the T237435: How to upgrade E3863 to make it work with EF6 ticket public. Please refer to it.

How to preview and print the XtraCharts control

This example demonstrates how to use the PrintableComponentLink from the XtraPrinting Library to print the ChartControl with the additional print options set, such as paper kind and the landscape layout.

See Also:
How to fit the size of a chart to the page width in the Print Preview
How to enhance the output quality of a chart in its Print Preview

Question Comments

Added By: Silver at: 10/20/2014 1:06:13 AM    

what is  printableComponentLink1 in the given code

Added By: Alex (DevExpress Support) at: 10/20/2014 1:38:26 AM    

Hi,

It is a special component designed to print all controls that support the IPrintable interface (see PrintableComponentLink).

Added By: Viviana Cano Castrillon at: 8/10/2015 9:45:20 AM    

How I cant preview and print whitn out this method my devexpress license i not containt this forma

Added By: John (DevExpress Support) at: 8/10/2015 10:45:37 PM    Hi Viviana,
I have moved your question into a separate ticket: How to preview and print Chart without PrintableComponentLink Let's continue the conversation there.

OData service - How to use stored procedures

This example illustrates how to use stored procedures with OData. You can learn how to map an entity to a stored procedure in this blog: Stored Procedures in the Entity Framework. This blog describes how to expose a stored procedure in the OData service: oData and Stored Procedures aka Service Operations. We suggest that you use the DevExtreme WCF OData Service project template when creating the OData service.


To execute a web method of the OData service, use the ODataStore.get method. For example:

[JScript]
store.get("TestOperation", { param1: 123, param2: "abc"}).done(...);


Here is a good blog describing how to configure the method so it supports the JSON format: Creating a .NET WCF 4.0 JSON Service.

Question Comments

Added By: Enderson Salas at: 8/25/2014 9:23:07 AM    

Can I use this to a stored procedure with a insert?

Added By: Marion (DevExpress Support) at: 8/26/2014 2:26:39 AM    

Hello Enderson,

To process your recent post more efficiently, I created a separate ticket on your behalf: T144008: OData service - How to use a stored procedure to insert data. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Chandru Nagrani 2 at: 12/26/2014 10:39:35 AM    

CustOrderHist_Result Where is this defined ? Thanks

Added By: Uriah (DevExpress Support) at: 12/29/2014 12:33:27 AM    

Hello Chandru,

To process your recent post more efficiently, I created a separate ticket on your behalf: T191552: Where is defined CustOrderHist_Result class?. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Kulasekaran K at: 5/17/2015 11:11:39 AM    

Hi

In below example in dataservice.svc.cs file there is only get method.can u suggest me how to handle update and delete record ?

Added By: Nikolai (DevExpress Support) at: 5/18/2015 1:58:20 AM    Hi Kulasekaran,

Please refer to the ASP.NET WebAPI vs WCF OData ticket where we discussed a similar issue.Added By: York Leung at: 8/10/2015 11:06:28 AM    

Hi,

can you tell me how to do the group on cust-order-hist.dxview dxList by ProductName , how to group the dataSource on cust-order-hist.js?

Added By: Marion (DevExpress Support) at: 8/11/2015 1:17:44 AM    

@York,

To process your recent post more efficiently, I created a separate ticket on your behalf: T276861: dxList - How to group data. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to customize the appearance of selected series points

This example shows how to change the selection color for series points. For this, it's necessary to create a custom series model.

To accomplish this, do the following:

1. Create an object that represents a custom model of a particular series (CustomBar2DModel) and assign it to the Model property of a corresponding series type (BarSeries2D.Model): E4593: How to create custom models for chart series

2. Create the System.Windows.Controls.ControlTemplate object which contains a Border element to create your own custom model.

3. Assign this template to the PointTemplate property of a series custom model (CustomBar2DModel.PointTemplate). 

4. Create the IsSelectedConverter. For this, create the IsSelectedToBrushConverter class inheritted from IValueConverter. Then, implement Convert and ConvertBack methods. The Convert method will return the black color if the IsSelected value is  true and red color -  otherwise.

5. Bind the Border.Background property to the SeriesPointPresentationData.IsSelected property using the IsSelectedToBrushConverter from the static resource. 

Note that the ChartControl.SelectionMode property must be set to Multiple to enable the chart selection. 

How to create custom models for chart series

This example illustrates how to create bar custom models.

To do this, create an object that represents a custom model of a particular series (CustomBar2DModel) and assign it to the Model property of a corresponding series type (BarSeries2D.Model).

Then, create the System.Windows.Controls.ControlTemplate object which contains all necessary visual elements to create your own custom model. Assign this template to the PointTemplate property of a series custom model (CustomBar2DModel.PointTemplate).

 
See Also:
How to customize the appearance of selected series points

RibbonForm - How to display ribbon page headers in the form's caption in the OfficeUniversal style

This example illustrates how to display ribbon page headers in the form's caption in the OfficeUniversal style
Image may be NSFW.
Clik here to view.
Question Comments

Added By: Justin Zeng at: 6/23/2015 2:58:15 AM    

OK, Thanks, I got it.

Added By: Mark Callahan at: 6/23/2015 7:28:38 AM    

this sample but with Office2013 style ?. thanks

Added By: Alisher (DevExpress Support) at: 6/24/2015 2:03:42 AM    

Hi Mark,

At present, such an example for the Office2013 style does not exist. We have added this example to our TODO list. Once we create it, we will update this ticket.

Added By: Vu Minh Long at: 8/12/2015 1:47:42 AM    

Hi Alisher, In this sample :
1/ If I view form in maximize mode, the title bar is very small to see the ControlBox, MaximizeBox, ...
2/ I cannot see the RibbonControlEx in the toolbox to drag and drop control into form.

Pls fixed these issues.
Thanks a lot.


How absolutely positioned elements behave in different containers

Popup elements of DevExpress controls have the position CSS property of its containers set to absolute. Thus, when placed in the relatively positioned container (for example, bootstrap grid system), popup elements may behave in an unexpected manner.
This example illustrates the issue and the way to fix it. In order to position popup elements correctly, change the container element positioning to static.

Please refer to the following KB article for more info: How to display a controls' popup elements correctly in the Bootstrap grid.

Report Server - How to get the list of available reports and display a report preview in a Windows Forms application

The sample demonstrates how to use the Report Server WCF API in a Windows Forms application.

Question Comments

Added By: Juan Carlos Cabrera 1 at: 4/21/2014 5:13:55 PM    

Hello!!... I have a question... What is ReportViewerForm?. Thanks

Added By: Igor D (DevExpress) at: 4/22/2014 1:22:12 AM    

Hi!
 
ReportViewerForm, as the name suggests, is a form with the DocumentViwer control. Please download the example to see the full source code.

Added By: Juan Carlos Cabrera 1 at: 4/22/2014 8:35:33 AM    

ooohhh!!... very good... it ́s great. Thanks

Added By: Pavan kumar 54 at: 8/12/2015 5:41:39 AM    

Thank you for the response, Don't i get an example in asp.net c# as our application is an asp.net application. Please suggest if you can help me this

Added By: Dmitry Tok (DevExpress Support) at: 8/12/2015 6:53:11 AM    

Hello Pavan,

We have a corresponding Code Example available for web platform Report Server - How to get the list of available reports and display a report preview in an ASP.NET MVC application. It would be great if you register a separate thread regarding the issue if this example doesn't help.

Thanks,
Dmitry

How to: Build a dock UI according to the MVVM pattern using MVVMHelper.SetTargetName

This example shows how to build a dock UI using the MVVM pattern.

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

Question Comments

Added By: David Lemieux at: 12/3/2013 5:38:24 AM    

How come the view should be responsible of creating documents and panels? In a true MVVM design this should be the ViewModel's responsibility.

Added By: David Lemieux at: 12/5/2013 8:17:17 AM    

Is anyone from DevExpress monitoring comments on examples?

Added By: Alex Zeller (DevExpress) at: 12/6/2013 5:07:00 AM    

Hello David,
The View only creates root containers where dock panels are placed. This is a required step of creating the Docking UI.

Added By: David Lemieux at: 12/16/2013 2:00:09 PM    

Alex, I was refering to MainWindow.xaml.cs file. It has AddPanel_Click and AddDocument_Click methods, in which view models instances are created.

If the purpose of the example is to demonstrate how DX docking can be used with the MVVM pattern, then the DockLayoutManagerViewModel class should be responsible for creating / adding documents. Giving this responsibility to the view class goes straight against MVVM design rules, IMHO.

Added By: Alex Zeller (DevExpress) at: 12/17/2013 4:34:14 AM    

David, you're right. We have moved the code that creates Panels and Documents to View Models.

Added By: David Lemieux at: 12/17/2013 5:16:25 AM    

Thanks. You might want to clean up MainPage's code too. The DockLayoutManagerViewModel is instanciated in both the XAML and code behind. ;)

Added By: Raju Muthu at: 1/6/2014 12:04:12 PM    

Can this example extended to using PRISM regions? or is there an example already with this feature utilizing Prism?

Added By: Gagan Kapoor at: 2/1/2014 2:54:16 PM    

Hi, I need a dock UI with ability to host different types of views in Document Group (Tabs) at run time using Prism. Can you point me to an example of it ?

Added By: Michael Ch (DevExpress Support) at: 5/22/2015 12:15:40 AM    

Hello Raju and Gagan,

We accidentally discovered that your initial posts were out of scope of our Support Center for a long time. Please accept our sincere apologies for not responding in a timely manner.

We have few samples showing of how to use the DXDocking suite with the Prism framework. Below is a list of them. Please take a moment to review them and let us know if you have additional questions.
1. Using DXDocking for WPF in accordance with Composite Application Guidelines 
2. How to use the DXDocking and DXBars components with Prism 
3. Prism - How to define Prism regions for various DXDocking elements 

Thanks,
Michael

Added By: Pere Pujol Espuña at: 6/19/2015 3:44:00 AM    

Hello,

I've been working on this sample but I have a question. How do you add a new mvvm view in a document ? For exemple a CustomerViewModel.... this is a plain sample documentViewModel1.Content = "Document View Model";   I've looking
for an easy sample to understand but I don't find anything...

Thank you!

Added By: Ivan (DevExpress Support) at: 6/19/2015 7:17:32 AM    

Hi Pere,
I see that you created a separate ticket about the same issue - T257623. We will answer you there.

OBSOLETE: How to resize a chart according to the actual size of a Web Browser's window

This example illustrates the capability to resize a WebChartControl to fit the page width when the web page is resized.

See also:
- E1242: How to link a web chart to an ASPxPivotGrid;
- E568: How to add a WebChartControl to the ASPxCallbackPanel on its callback;
- E258: How to show custom data over WebChartControl using ASPxPopupControl.

NOTE: The approach described in this example is a proof of the concept, but it should not be used in any real-life scenario. We have added the Obsolete prefix to emphasize this statement. If multiple users try to resize charts, the server may not be able to handle a very large amount of requests at once. As a better solution, add the 'Update' button to the tab page and use it to send a callback and resize the chart only when it is necessary.
If you need a dynamic resizing functionality, it is better to look at the JS Charts Suite that provides JS controls that are rendered on the client side and can be resized dynamically. You can find more information on how to use JS Charts in the following example: How to use the dxChart in an ASP.NET WebForms application

Question Comments

Added By: Maxim Sidorenko at: 4/17/2013 10:38:33 AM    

Please, provide an example how to do it using MVC

Added By: Alex (DevExpress Support) at: 4/18/2013 10:42:09 AM    

Hi,

Please review my answer in the How to resize a chart according to the container actual size using MVC ticket and feel free to update the ticket if further assistance is necessary.

Added By: Tamer at: 6/30/2013 6:12:43 AM    

what if the Chart Control inside ASPxPanel and that panel take width =100%

what the way to make take the parent width ,but the parent take width as %

Added By: Puthy wong at: 8/12/2015 9:07:02 PM    

I follow this but it still does not work to me. Any more idea?

Added By: John (DevExpress Support) at: 8/12/2015 11:46:11 PM    Hi,
I have created a separate ticket on your behalf: How to resize a chart according to the actual size of a Web Browser's window. Let's continue the conversation there.

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

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

How to implement a custom LookUpEdit supporting Server Mode

The current LookUpEdit version does not allow using Server Mode datasources. This example demonstrates how to create a custom editor that allows using them.

Question Comments

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

Hi,

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

Thanks.

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

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

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

Hi Justin,

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

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

Hi Alex,

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

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

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

Thanks,
Michael

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

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

This needs a proper solution. Urgently.

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

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

XRPivotGrid - How to draw vertical column headers

This example illustrates how to use the XRPivotGrid.PrintFieldValue event handler to render vertical headers in the XRPivotGrid control.

In this sample, the default TextBrick is substituted with LabelBrick and the LabelBrick.Angle property is set to rotate text.


How to connect to a remote data service instead of using a direct database connection

Scenario

In this example, we will create a WCF IDataStore service that will be used by our client (Console Application) as a data layer. Instead of the direct connection to the database, our client will connect to a remote service, which is way more secure and thus important in many enterprise scenarios as database connection settings are not exposed to the client.


Steps to implement

1. Create a new WCF Service Application project and add references to the DevExpress.Data and DevExpress.Xpo assemblies and remove files with auto-generated interfaces for the service.

2. Modify the service class as shown in the Service1 file. This service initializes a connection provider and stores it in the static DataStore property, which is then used by the base DataStoreService class.

3. Change some binding properties as shown in the example's web.config file. At this stage, the service part is ready to work and we need to implement a client to consume data from our data store service (for demonstration purposes, we will create a Console Application).

4. Add the Console Application into the existing solution.

5. Add a new code file for a Customer class using the DevExpress v1X.X ORM Persistent Object item template. See a code of Customer class in the ConsoleApplication\Customer code file.

6. Pass the address of our service into the GetDataLayer method of the XpoDefault class. For this, modify the Main method of the Console Application as shown in the ConsoleApplication\Program code file. Please note that the port number in the connection string may be different. You can check it in the properties of the service project in the Solution Explorer:

Image may be NSFW.
Clik here to view.


As a result, we will see the following output:

Image may be NSFW.
Clik here to view.

Important notes
If you are using an XAF client, then in the simplest case, you can just set the XafApplication.ConnectionString to the address of your data store service (http://localhost:55777/Service1.svc). Refer to the Connect an XAF Application to a Database Provider help article for more details.

Troubleshooting
1. If WCF throws the "Entity is too large" error, you can apply a standard solution from StackOverFlow: http://stackoverflow.com/questions/10122957/
2. If WCF throws the "The maximum string content length quota (8192) has been exceeded while reading XML data." error, you can extend bindings in the following manner:

[XML]
<bindings><basicHttpBinding><bindingname="ServicesBinding"maxBufferPoolSize="2147483647"maxReceivedMessageSize="2147483647"maxBufferSize="2147483647"transferMode="Streamed"><readerQuotasmaxDepth="2147483647"maxArrayLength="2147483647"maxStringContentLength="2147483647"/></binding></basicHttpBinding></bindings>

See The maximum string content length quota (8192) has been exceeded while reading XML data

See Also:
How to use XPO with a Web Service
Transferring Data via WCF Services
How to connect to a remote data service from a Silverlight application

How to create a data caching service that helps improve performance in distributed applications

How to implement a distributed object layer service working via WCF

How to connect to remote data store and configure WCF end point programmatically

 

Question Comments

Added By: NBT Developers at: 5/28/2014 10:39:32 AM    

FYI on this part "If you are using an XAF client, then in the simplest case, you can just set the XafApplication.ConnectionString to the address of your data store service (http://localhost:55777/Service1.svc). "

Literally do this:
WebApplication.Instance.ConnectionString = "http://localhost:55777/Service1.svc&quot;;

XpoDefault.DataLayer = XpoDefault.GetDataLayer("http://localhost:55777/Service1.svc&quot;,
           AutoCreateOption.DatabaseAndSchema);

           XpoDefault.Session = null;

           using (UnitOfWork uow = new UnitOfWork())
           {
           }

Added By: Jarkko Nieminen 1 at: 8/14/2015 5:38:07 AM    

I got the  "Entity is too large"- execption even after I did the fix provided.  Adding behaviorConfiguration="WcfService1.Service1Behavior" attribute to the service node fixed the problem.

How to Select Rows via the Mouse

This example demonstrates how to select rows by simply moving the mouse over them with the mouse button pressed

Question Comments

Added By: Daniel Kaminski at: 8/14/2015 6:46:32 AM    

Thanks for the example. Here is the code that will do the same for columns. You could post it for others to use if you like

   Private m_nStartColumn As Integer = -1
   Private m_nCurrColumn As Integer = -1
   ''' <summary>
   ''' ** Columnn selection
   ''' </summary>
   ''' <param name="sender"></param>
   ''' <param name="e"></param>
   ''' <remarks></remarks>
   Private Sub gvJob_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles gvJob.MouseDown
       Dim view As GridView = TryCast(sender, GridView)
       m_nStartColumn = GetColumnAt(TryCast(sender, GridView), e.X, e.Y)
   End Sub
   Private Sub gvJob_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gvJob.MouseMove
       Dim nCol As Integer = GetColumnAt(TryCast(sender, GridView), e.X, e.Y)
       If m_nCurrColumn <> nCol AndAlso nCol > -1 Then
           m_nCurrColumn = nCol
           SelectColumns(TryCast(sender, GridView), m_nStartColumn, m_nCurrColumn)
       End If
   End Sub
   Private Sub gvJob_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gvJob.MouseUp
       m_nStartColumn = -1
       m_nCurrColumn = -1
   End Sub
   Private Function GetColumnAt(ByVal view As GridView, ByVal x As Integer, ByVal y As Integer) As Integer
       Dim hi As GridHitInfo = view.CalcHitInfo(New Point(x, y))
       'If hi.Column.Visible = false
       If hi.InColumn AndAlso hi.Column.Visible Then Return hi.Column.AbsoluteIndex
       Return -1
   End Function
   Private Sub SelectColumns(ByVal view As GridView, ByVal nStartCol As Integer, ByVal nEndCol As Integer)
       If nStartCol > -1 AndAlso nEndCol > -1 Then
           view.BeginSelection()
           view.ClearSelection()
           Dim nStep As Integer = 1
           If nStartCol > nEndCol Then nStep = -1
           For nCol As Integer = nStartCol To nEndCol Step nStep
               SelectCells(view, nCol)
               'Debug.WriteLine("Selected Col {0}", nCol)
           Next
           view.EndSelection()
           view.Invalidate()
       End If
   End Sub
   Private Sub SelectCells(ByVal view As GridView, ByVal nCol As Integer)
       Dim gc As GridColumn = view.Columns(nCol)
       For i As Integer = 0 To view.RowCount - 1
           view.SelectCell(i, gc)
       Next i
   End Sub

How to select a column in the XtraGrid (like in MS Excel)

This example demonstrates how to select the whole column in the XtraGrid. For more information, please review the How to select a column in the XtraGrid (like in MS Excel) Knowledge Base article.

See Also:
Appearances Overview

Question Comments

Added By: Daniel Kaminski at: 8/14/2015 5:53:51 AM    

Hi,
I am trying to implement a drag select option for columns. something similar to what is already implemented for rows.
i.e. when the user drags across the column header I would like the grid to select all rows for the dragged columns.

I used the following code so far, but is not quite what I am looking for, it only works when a column header is clicked. I would like to be able to drag and select multiple columns.

   Private Sub gridView1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles gvJob.MouseDown
       Dim view As GridView = TryCast(sender, GridView)
       Dim hi As GridHitInfo = view.CalcHitInfo(New Point(e.X, e.Y))
       If hi.InColumn Then
           SelectCells(view, hi.Column)
       End If
   End Sub
   Private Sub SelectCells(ByVal view As GridView, ByVal column As GridColumn)
       For i As Integer = 0 To column.View.RowCount - 1
           view.SelectCell(i, column)
       Next i
   End Sub

Here is a short video of what I am looking for http://screencast.com/t/pAqDpiYPqt

Added By: Andrew Ser (DevExpress Support) at: 8/14/2015 9:25:30 AM    Hello Daniel,
I see that you posted a solution for this in the How to Select Rows via the Mouse thread. Am I right that you implemented the required functionality?

How to set up binding for a web report using a collection of custom objects as a data source at design time

This example illustrates how to bind a report to lists for web projects at design time. To do this you need to extract your reports together with the corresponding classes representing your business objects into a separate assembly. Then, you can easily perform all necessary design-time binding using the BindingSource component (by specifying the required object type as its DataSource).

This approach differs from how this is done under the Windows Forms platforms in that you cannot assign your object to the BindingSource.DataSource property at design time. Instead, you should perform the binding right within the InitializeComponent method.

Question Comments

Added By: CodeGal at: 1/21/2014 7:21:17 PM    

So what are the design time bindings for controls set to in the report?

Added By: Olena at: 3/5/2014 5:03:22 PM    

Hi Support Team,
I've just downloaded Example and I see error in the XtraReport1.cs tab saying

"Could not find type 'Reports.Data'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU. "

Unfortunately there is no ability to attach print screen.
What can I do to fix it?

Thanks!

Added By: ghsPt at: 4/7/2014 10:21:33 AM    

Hello!

I have a dataset with several objects.
If I want a list of several different objects with only one datasource, how can I do that?

Added By: Matt_Olson at: 7/20/2014 3:57:26 PM    

Missing design time objects in xtrareport1.cs

Added By: Andrew L (DevExpress Support) at: 7/21/2014 7:21:26 AM    Hello Matt,

To process your recent post more efficiently, I created a separate ticket on your behalf: T131788: E1936 - Missing design time objects . This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Matt_Olson at: 7/21/2014 8:03:37 AM    

Sorry, I see that the missing source code is in the Example Runner download.  It is only missing from the web viewable portion (such as definition for InitializeComponent()) which is in XtraReport1.designer.cs I'm guessing which isn't in the web viewable version.

Added By: Andrew L (DevExpress Support) at: 7/21/2014 10:02:49 PM    Hi Matt,

I am happy to hear that the problem has been resolved. Thank you for letting us know of your progress. Please feel free to contact us if you have any further difficulties. We will be happy to assist youAdded By: Lisa Bencic at: 8/27/2014 1:52:19 PM    

I run this example in my 14.1 environment and it works fine.  If I swap out the Report Viewer for the ASPxDocumentViewer, I get the old "Object reference not set...."
Is there an example that uses ASPxDocumentViewer?  
I saw in this link: http://www.devexpress.com/Support/Center/Question/Details/T119505
That it's 'NOT' good to store the Xtrareport in a session variable, that it is too complex.  Is it more complex with the Doc Viewer instead of Report Viewer?

Added By: Dmitry Tok (DevExpress Support) at: 8/27/2014 10:33:45 PM    

Hello Lisa,

To process your recent post more efficiently, I created a separate ticket on your behalf: T144862: How to set up binding for a web report using a collection of custom objects as a data source at design time. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
Thanks

Added By: Aakash Bashyal Bashyal at: 8/14/2015 8:54:02 PM    

Please provide the Example in MVC for the same purpose.

How to change connection to the database at runtime

This example shares some code that can be used to promote your application to another database after the application is already started. To accomplish this task, we have implemented two platform-dependent controllers that have the ChangeDatabase Action.

See also:
Database: How to show Business Classes from several databases in a XAF application

Question Comments

Added By: Mario Blatarić at: 11/5/2012 11:23:09 AM    

Let me give you "some reasons" why this isn't such a specific scenario.
 - accountant company doing accounting for several different companies (it's business requirement that data for each company is in separate database)
 - building maintenance company - again - business requirements demands each building to live in separate database (because of financial data)
 - document managment companies doing document management for multiple companies - again, each company must live in seperate database
 - local community combined with utility company - same people do both things and want to keep things separated

If you like, I can go on. No, you can't go to this companies / communities and say "But, it's better if we put all this to one database" because they will reply "Thank you, we'll find someone who can do it with multiple databases".
The point is, there are many reason why one piece of software should be connecting to multiple databases, so it's not such a specific scenario really. It would be nice to have this functionality out of the box instead of implementing this hard to understand piece of code.
Also, since application is distributed to many different clients, it would be nice that end-user could setup application on first startup (add/create required databases with connection info).

Added By: Mario Blatarić at: 3/14/2013 9:51:50 AM    

This example doesn't work.
Go to WinChangeDatabaseController.cs and set breakpoint in changeDatabaseAction_Execute. This code never executes since created SingleChoiceAction is not visible on logon form, instead some default editor is created with PredefinedValues and it's behaviour is not modified.
Can you fix this code please?

Added By: Dennis (DevExpress Support) at: 3/28/2013 4:52:33 AM    

@Mario: I have answered you in www.devexpress.com/issue=Q484359
This example worked correctly in my tests. In any event, I have just updated it to .NET Framework 4.0, just for more convenience.

Added By: Mario Blatarić at: 3/28/2013 6:17:17 AM    

Thanks Dennis. I understand now how this works.

Added By: lekan odejimi at: 1/29/2014 1:28:06 AM    

Hi Dennis, each time i try to logon i keep on getting this error: "Make sure your user name is correct and retype the password in the correct case." What do you suggest?

Added By: Grégoire Perruchoud at: 3/20/2014 9:52:00 AM    

Hi,

Great piece of code !

I noticed a weakness. In Web/Win controllers, preselection of correct item is done via following code :
if (Application.ConnectionString.Contains((string)item.Data))

This fails in case database name's string is contains elsewhere in ConnectionString. It also fails in case we have multiple databases with names containing each other, for example "customers" and "customers_geneva".

We should store the current database name in a static property somewhere and make a strong comparison.

Added By: Achmad Mulyadi at: 8/15/2015 12:11:19 AM    

Hi Dennis,

From the code below,

public const string Databases = "ChangeDatabase_DB1;ChangeDatabase_DB2";

Is there anyway I can pass a dynamic attribute value? I know this attribute requires a fixed value in compile time, but I don't think it is practical to put the database name or maybe a server address in a hard coded way. For example, it would be very practical if we can read this value from the app.config file, and pass it to the ModelDefault attribute.

Viewing all 7205 articles
Browse latest View live


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