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

How to add a Find Panel, similar to the one provided by GridControl to TreeList

$
0
0

This feature is available out-of-the-box starting from version 12.2.

For earlier versions:

This example illustrates how to create your own Find Panel and show over TreeList.

Question Comments

Added By: Sigrid Villagomez 1 at: 5/30/2012 11:18:50 AM    

WHERE DID YOU GET THE DATA FROM?

Added By: Declan M at: 5/10/2013 6:03:40 PM    

Hi. I have installed version 12.2.8 of DevExpress and would like to use this feature. I have a form with a TreeList in it. From reading online it seems I need to set ColumnViewOptionsFind.AllowFindPanel to true.
Or do I just create an instance of ColumnViewOptionsFind and specify the property:

ColumnViewOptionsFind optFind = new ColumnViewOptionsFind();
optFind.AllowFindPanel = true;

I'm not sure.

Added By: Svetlana (DevExpress Support) at: 10/1/2013 8:12:25 AM    

Hi,

To access the TreeList's Find Panel settings, use the TreeList.OptionsFind property.

Added By: Anders Wang at: 7/31/2014 10:55:51 PM    

After set AllowFilter = True, Find "Mark", Nothing founded. However, It should be "Marketing......" node.

Added By: Alisher (DevExpress Support) at: 8/1/2014 1:32:41 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T135997: How to add a Find Panel, similar to the one provided by GridControl to TreeList. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.


How to add secondary axes to a chart

ASPxGridView - How to filter the grid using the outside combo box

$
0
0

This sample demonstrates how to filter the grid using the outside combobox and grid custom callbacks.

See also:
ASPxGridView - How to apply a filter to a column on the server side
How to filter ASPxGridView bound to SqlDataSource by using an external ASPxComboBox in ASPxRoundPanel
How to filter ASPxGridView bound to SqlDataSource by using an external ASPxComboBox in Template

Question Comments

Added By: Jon Forst at: 8/1/2014 8:17:08 AM    

MVC Example?

Added By: Artem (DevExpress Support) at: 8/1/2014 1:03:19 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T136250: GridView - External combo box filter. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Lesson 4 - Simple Navigation in MVPVM Application

Lesson 5 - Complex Navigation in MVPVM Application

How to view persistent objects in the XtraGrid and edit them in a separate window

$
0
0

This example demonstrates how to edit XPO objects in the scope of a UnitOfWork, so that the changes made to the object's properties can be saved or canceled.

See Also:
XPO Best Practices

How to configure dxPopover

How to use LINQ to SQL data source to create a Master-Detail report

$
0
0

It's possible to use LINQ to SQL API to bind an XtraReport document to data.
To set up report controls' bindings at design time, use the BindingSource component, which DataSource property is set to the parent (Master) object.
The relation between objects will be recognized automatically.
Then, use a Detail Report Band to create a Master-Detail report layout (see How to: Create a Master-Detail Report using Detail Report Bands).
In the example, Order -> Order_Detail collections (Northwind database) are used.

In addition, you can filter query results using Linq to Sql syntax.
For instance, use the following code to display a report document, containing Northwind Orders data filtered by customers, whose CustomerID starts with letter "B".

[C#]
NwindDataContextdc=newNwindDataContext();var_data=from_ordersindc.Orderswhere_orders.CustomerID.StartsWith("B")select_orders;XtraReport1report=newXtraReport1();BindingSourcebs=(BindingSource)report.DataSource;bs.DataSource=_data;
Question Comments

Added By: NoronhaJR at: 10/18/2012 6:44:40 AM    

Gostaria de fazer isso usando Aplicação Web? Como faço para realizar a conexão utilizando LINQ?

Added By: NoronhaJR at: 10/18/2012 6:45:02 AM    

I would like to do this using Web Application? How do I make the connection using LINQ?

Added By: pangeran thoha at: 12/4/2012 5:54:59 PM    

i got this message "Unable to cast object of type 'WindowsFormsApplication3.depnakerDataSet' to type 'System.Windows.Forms.BindingSource'."
 while casting report.DataSource (dataset) to BindingSource => BindingSource bs = (BindingSource)report.DataSource;
did i miss something?

Added By: mostafa alaa at: 8/3/2014 6:31:24 AM    

Unable to cast object of type 'WindowsFormsApplication3.depnakerDataSet' to type 'System.Windows.Forms.BindingSource'.

what can i do ??

Added By: Ingvar (DevExpress Support) at: 8/4/2014 2:07:22 AM    Mostafa,

Please create a separate ticket and provide us with a sample project there.

How to: Add an Action to Form

TokenEdit - How to create one token per line

$
0
0
This example demonstrates how to create one token per line.

How to add a complex index involving XPO service columns (GCRecord and ObjectType)

$
0
0

Scenario
This article demonstrates how to use the IndexedAttribute with the service XPO columns (ObjectType and GCRecord) to accomplish the following requirements:

1. Make persistent objects data unique against the class type;
2. Avoid data duplication with records that are already deleted, but are still physically present in the database due to the enabled deferred deletion.


Steps to implement
1. Decorate the required data property, which must be unique against the object type with the DevExpress.Xpo.Indexed attribute taking "ObjectType" and Unique = true as parameters.
2. Decorate the required data property, which must be unique without taking into account deleted records data with the DevExpress.Xpo.Indexed attribute taking "GCRecord" and Unique = true as parameters.
Check out the BasePersistentClass class in the BO.xx file and unit tests within the Program.xx file for more details.

IMPORTANT NOTES

1. Beware of MS Access limitation which lies in skipping NULL values when checking value uniqueness.
2. The IndexedAttribute/IndicesAttribute involving the service ObjectType and GCRecord columns can be used only in the base persistent class, because XPO creates these columns only in the base table. 
To add uniqueness on the service columns in the derived class, you should declare additional persistent clone-properties that will return the value of the corresponding source property. Refer to the 
Check out the DerivedPersistentClass class in the BO.xx file for more details.


See Also:
IndexedAttribute Class
IndicesAttribute Class
Table Indexes

HtmlEditor - 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 customize the secondary axis range when the chart zooming is performed

$
0
0

This example shows how to adjust the secondary Y-axis range along which the chart is zoomed.

 

GridView - How to update total summaries on the client side in Batch Edit mode

$
0
0
This example demonstrates how to update total summaries on the client side when GridView is in Batch Edit mode. To implement the required task, perform the following steps:

1. Add a total summary item for a required column. The Tag property is used to find this summary item and get its value: 

[C#]
settings.Columns.Add(column=>{column.FieldName="C2";column.ColumnType=MVCxGridViewColumnType.SpinEdit;ASPxSummaryItemsummaryItem=newASPxSummaryItem(column.FieldName,DevExpress.Data.SummaryItemType.Sum);summaryItem.Tag=column.FieldName+"_Sum";summaryItem.DisplayFormat="{0}";settings.TotalSummary.Add(summaryItem);});

 2. Replace the summary item with a custom Footer template:

[C#]
column.SetFooterTemplateContent(c=>{Html.DevExpress().Label(lbSettings=>{stringfieldName=(c.ColumnasGridViewDataColumn).FieldName;lbSettings.Name="labelSum";lbSettings.Properties.EnableClientSideAPI=true;ASPxSummaryItemsummaryItem1=c.Grid.TotalSummary.First(i=>i.Tag==(fieldName+"_Sum"));lbSettings.Text=c.Grid.GetTotalSummaryValue(summaryItem1).ToString();}).Render();});


 3. Handle the grid's client-side BatchEditEndEditing event to calculate a new summary value and set it when any cell value has been changed:

[JScript]
function OnBatchEditEndEditing(s, e){var originalValue = s.batchEditApi.GetCellValue(e.visibleIndex, "C2");var newValue = e.rowValues[(s.GetColumnByField("C2").index)].value;var dif = newValue - originalValue; labelSum.SetValue((parseFloat(labelSum.GetValue()) + dif).toFixed(1));}

4. Finally, replace standard Save changes and Cancel changes buttons with custom buttons to refresh a summary value when all modifications have been canceled:

[C#]
settings.SetStatusBarTemplateContent(c=>{ViewContext.Writer.Write("<div style='text-align: right'>");Html.DevExpress().HyperLink(hlSettings=>{hlSettings.Name="hlSave";hlSettings.Properties.Text="Save changes";hlSettings.Properties.ClientSideEvents.Click="function(s, e){ GridView.UpdateEdit(); }";}).Render();ViewContext.Writer.Write(" ");Html.DevExpress().HyperLink(hlSettings=>{hlSettings.Name="hlCancel";hlSettings.Properties.Text="Cancel changes";hlSettings.Properties.ClientSideEvents.Click="function(s, e){ GridView.CancelEdit(); GridView.Refresh(); }";}).Render();ViewContext.Writer.Write("</div>");});


See Also:
GridView - Batch Edit - How to calculate values on the fly 
GridView - Batch Edit - How to calculate unbound column and total summary values on the fly

ASP.NET Web Forms Example:
ASPxGridView - How to update total summaries on the client side in Batch Edit mode 

ASPxGridView - How to update total summaries on the client side in Batch Edit mode

$
0
0

This example demonstrates how to update total summaries on the client side when ASPxGridView is in Batch Edit mode. To implement the required task, perform the following steps:

1. Add a total summary item for a required column. The ASPxSummaryItem.Tag property is used to find this summary item on the server side: 

[ASPx]
<SettingsShowFooter="true"/><TotalSummary><dx:ASPxSummaryItemSummaryType="Sum"FieldName="C2"Tag="C2_Sum"/></TotalSummary>

 2. Replace the summary item with a custom Footer template:

[ASPx]
<dx:GridViewDataSpinEditColumnFieldName="C2"><FooterTemplate> Sum = <dx:ASPxLabelID="ASPxLabel1"runat="server"ClientInstanceName="labelSum"Text='<%# GetTotalSummaryValue() %>'></dx:ASPxLabel></FooterTemplate></dx:GridViewDataSpinEditColumn>

 The GetTotalSummaryValue method is used to get the actual summary value when the grid is initialized:

[C#]
protectedobjectGetTotalSummaryValue(){ASPxSummaryItemsummaryItem=Grid.TotalSummary.First(i=>i.Tag=="C2_Sum");returnGrid.GetTotalSummaryValue(summaryItem);}

 3. Handle the grid's client-side BatchEditEndEditing event to calculate a new summary value and set it when any cell value has been changed:

[JScript]
function OnBatchEditEndEditing(s, e){var originalValue = s.batchEditApi.GetCellValue(e.visibleIndex, "C2");var newValue = e.rowValues[(s.GetColumnByField("C2").index)].value; var dif = newValue - originalValue; labelSum.SetValue((parseFloat(labelSum.GetValue()) + dif).toFixed(1));}

4. Finally, replace standard Save changes and Cancel changes buttons with custom buttons to refresh a summary value when all modifications have been canceled:

[ASPx]
<Templates><StatusBar><divstyle="text-align: right"><dx:ASPxHyperLinkID="hlSave"runat="server"Text="Save changes"><ClientSideEventsClick="function(s, e){ gridView.UpdateEdit(); }"/></dx:ASPxHyperLink><dx:ASPxHyperLinkID="hlCancel"runat="server"Text="Cancel changes"><ClientSideEventsClick="function(s, e){ gridView.CancelEdit(); gridView.Refresh(); }"/></dx:ASPxHyperLink></div></StatusBar></Templates>


See Also:

ASPxGridView - Batch Edit - How to calculate values on the fly 
ASPxGridView - Batch Edit - How to calculate unbound column and total summary values on the fly 

ASP.NET MVC Example:
GridView - How to update total summaries on the client side in Batch Edit mode

Question Comments

Added By: Dhaval.Shah at: 6/23/2014 5:25:31 PM    

Hi Larry,
Good example for us, I must admit.
I noticed one thing:
I modify C2 value and press TAB, the total updates correctly.
However, when I "cancel changes" the total does not revert to the previous (unchanged) one.
Thought I'd let you know.
Best regards

Added By: Larry (DevExpress Support) at: 6/24/2014 7:52:35 AM    Hi Dhaval,

Thank you for your attention. I have modified the example. Added By: Dhaval.Shah at: 6/24/2014 7:51:38 PM    

Hi Larry,
Thanks for the prompt (as always) update, much appreciated.
It works. However, something's not right it appears:
Please try this.
Run the example, click on first row C2 column, type a number and press TAB.
I ran it in Chrome and the total was not updated (the value in cell reverted to the original value 0).
Then, I went back to the same cell, typed another number and pressed ENTER.
this time it updated correctly.
I must be doing something wrong, but thought I'd run it past you first.
Do update the thread when you can please.
Thanks.

Added By: Larry (DevExpress Support) at: 6/25/2014 3:09:00 AM    Thank you for the clarification. I have created a separate ticket on your behalf to process the issue more effectively:
ASPxGridView - Batch Editing - Some issues with the T114923 example
Please refer to it for further correspondence.              

GridView - Batch Edit - How to calculate unbound column and total summary values on the fly

ASPxGridView - Batch Edit - How to calculate values on the fly

$
0
0

This example demonstrates how to create an unbound column that calculates the sum of other columns and changes its values on the fly when end-user changes any grid values using Batch edit mode. To implement the required task, perform the following steps:

1. Create an unbound column in the same manner as described in the ASPxGridView.CustomUnboundColumnData Event help article:

[ASPx]
<dx:GridViewDataTextColumnFieldName="Sum"UnboundType="Decimal"ReadOnly="true"></dx:GridViewDataTextColumn>
[C#]
protectedvoidGrid_CustomUnboundColumnData(objectsender,ASPxGridViewColumnDataEventArgse){if(e.Column.FieldName=="Sum"){decimalprice=Convert.ToDecimal(e.GetListSourceFieldValue("Price"));intquantity=Convert.ToInt32(e.GetListSourceFieldValue("Quantity")); e.Value=price*quantity;}}

2. Handle the client-side ASPxClientGridView.BatchEditStartEditing event to save the currently edited column name as a global JavaScript variable:

[JScript]
var currentColumnName;function OnBatchEditStartEditing(s, e){ currentColumnName = e.focusedColumn.fieldName;}

 3. Handle the ASPxClientGridView.BatchEditEndEditing event to re-calculate the values based on the new changes and set it to the unbound column using the ASPxClientGridViewBatchEditApi.SetCellValue method:

[JScript]
function OnBatchEditEndEditing(s, e){ window.setTimeout(function(){var price = s.batchEditApi.GetCellValue(e.visibleIndex, "Price");var quantity = s.batchEditApi.GetCellValue(e.visibleIndex, "Quantity"); s.batchEditApi.SetCellValue(e.visibleIndex, "Sum", price * quantity);}, 10);}

 
See Also:

ASPxGridView - How to update total summaries on the client side in Batch Edit mode
ASPxGridView - Batch Edit - How to calculate unbound column and total summary values on the fly 

ASP.NET MVC Example:
GridView - Batch Edit - How to calculate values on the fly

Validation - How to highlight invalid properties when the View is shown

$
0
0

This example demonstrates, how to check rules when the View is activated, or the View's object is changed. For that purpose, the ImmediateValidationController is implemented. To avoid checking these rules when the business object is saved or deleted, their context is set to Custom.

Question Comments

Added By: Robert Emslie 1 at: 6/6/2014 6:00:21 AM    

This controller causes serious performance issues where validation requires database reads for uniqueness etc.

Added By: Anatol (DevExpress Support) at: 6/9/2014 9:46:37 AM    

This behavior is expected, taking into account the ImmediateValidationController's implementation. It checks validation rules on each ObjectChanged event, and thus, if these rules require searching in the database, performance may be affected. To improve performance, do not check such rules on ObjectChanged. Either do not subscribe to the ObjectChanged event in ImmediateValidationController at all, or declare rules that should be checked on ObjectChanged in a different context, and only check this context in the ObjectChanged event handler.

Added By: Vekrasoft at: 8/5/2014 6:07:42 AM    

Hello,

Thanks for this example. I've implemented it and changed it to work with a different context.
We use the 'OnChanged' context to the rules and in this controller we call the ValidateAllTargets function with this context.
This works fine if a validation rule ContextIDs property is exactly set to 'OnChanged' but now we want to connect it to more than one context so changed this to 'Save, OnChanged'. This should work according your documentation. But after this change the rules are not checked anymore. When validating in the Save action, the rules are validated as expected.

Could you please help? Thanks.

Added By: Vekrasoft at: 8/5/2014 7:22:44 AM    

Hi, I looked into the source code and found out that we need to split the different contexts in the string with te ';' separator in stead of the ',' separator. My bad. Works now as expected. Thank you.

Added By: Anatol (DevExpress Support) at: 8/5/2014 7:36:17 AM    

I am happy to hear that you have found a solution. Please let me know if there is a documentation topic that contains incorrect information about the separator.

Show a popup window in response to right-clicking a grid row

$
0
0

This demo shows how to:
    - Use client-side events to respond to right-clicking a grid.
    - Use client-side functions to identify the clicked row.
    - Invoke a popup control with additional information about the clicked row.
    
    Please look at the JS code (JS tab on the Code page) to find out how to do this.

Question Comments

Added By: Brad C at: 8/5/2014 4:30:02 PM    

what is popup_notesEditor ?? doesn't seem to be declared anywhere

Added By: Andrew (DevExpress) at: 8/5/2014 10:52:03 PM    

Hi Brad,
Yes, it is not obvious. Let me explain this.
The most our server side asp.net controls have corresponded j script/client widgets. They have the same name as server side control. For example, ASPxGridView  on server and ASPxClientGridView on client.
The grid in this example has name “grid” ID="grid" PopupControl has ID=”popup”, Memo control inside the popup control has ID=”notesEditor”. The full name for memo control (id + all parent controls ids, excluding page) is “popup_notesEditor”. So here is what we have.
If you run the demo and “View Source”, you will see the following generated Jscript:
var dxo = new ASPxClientMemo('popup_notesEditor');

Thank you,
Andrew R&D.

How to export ASPxPivotGrid and bound WebChartControl to the same print document

$
0
0

This example illustrates how to export ASPxPivotGrid and bound WebChartControl to the same print document

Question Comments

Added By: Tam Vuong at: 5/16/2013 7:09:50 PM    

I follow the code and it just print out a blank webchartcontrol layout. Same problem with other example of printing webchartcontrol in landscape mode.

Added By: Ram dasari at: 8/6/2014 12:03:03 AM    

Warning in excel when export chart and pivot at same time.
"Office has detected a problem with this file. Do you want to recover ..." warning is displayed in Office Excel 2013.
When enabled editing we get this error 'Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.'

Is it due to the explanation at http://www.devexpress.com/Support/Center/Question/Details/B190669 ?

Added By: Artem (DevExpress Support) at: 8/6/2014 12:29:24 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T137462: "Office has detected a problem with this file. Do you want to recover ..." warning is displayed in Office Excel 2013 when exporting ASPxPivotGrid and bound WebChartControl to the same print document . This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Viewing all 7205 articles
Browse latest View live


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