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

How to implement the ISearchControlClient interface

$
0
0

We have SearchControl (added in v14.1), which provides the search and filter functionality for the attached object. SearchControl can be attached to objects that support the ISearchControlClient interface. You can find a list of our controls that support this interface out of the box in the SearchControl help topic.
However, this list can be extended by your own. This example illustrates how to implement the ISearchControlClient interface for a Form for searching and highlighting controls by their names.

To introduce the ISearchControlClient interface into your project, implement the following members:
 - SetSearchControl - this method is invoked when you attach/detach your object from the SearchControl.Client property.
 - IsAttachedToSearchControl - this property determines whether your object is attached to SearchControl.
 - ApplyFindFilter - this method is invoked when filtering is performed. Here you need to implement your own logic for filtering.
 - CreateSearchProvider - this method must return SearchControlProviderBase's descendant. This provider contains SearchText and FilterCondition obtained from the RepositoryItemSearchControl.FilterCondition property.
It is necessary to override the SearchControlProviderBase.GetCriteriaInfoCore method to return SearchInfoBase's descendant. This instance should contain all required information for your filtering. It is passed to the ApplyFindFilter method as a parameter.


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.              Added By: Alfredo Bergamo at: 11/10/2014 8:48:10 AM    

What happens if you add new rows or delete some of them? How I get the new sum?

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

$
0
0

This example illustrates how to implement custom date validation in Batch Edit mode: 
1) The ASPxClientGridView.BatchEditRowValidating event is used to check values on the client.
2) The ASPxGridView.RowValidating event is used to check values on the server.
3) The GridViewBatchEditSettings.AllowValidationOnEndEdit property allows switching validation modes on the client side.  

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

How to create an editor similar to Outlook Attachment Editor

$
0
0

This example demonstrates how the RichEditControl component can be used to emulate the Outlook Attachment Editor behavior.

The main idea of the approach demonstrated in this sample is to use the DOCVARIABLE field to display corresponding RTF content for each inserted file.

Question Comments

Added By: maulik shah 5 at: 5/14/2014 9:10:23 PM    

Hi
     This is a good example for attachment. I have implemented  in my project. Now i want if i click on that file, file download on selected folder.

Added By: Oleg (DevExpress Support) at: 5/15/2014 5:36:46 AM    

Hello,
In this sample, when you click a file, this file is opened with the assigned application. However, you can simply implement any custom logic when an end-user clicks the file in the RichEditControl.HyperlinkClick event handler.
I have attached a modified version of this sample to demonstrate how you can save the file to another location.
I hope you will be able to adapt this sample for your real application.

Added By: maulik shah 5 at: 11/10/2014 9:47:23 PM    

Hi,

         I have faces issue while attachment. there are some file attached but not shown in richeditcontrol.
can you please help to resolve it.

Added By: Oleg (DevExpress Support) at: 11/10/2014 10:36:08 PM    

Hello Maulik,
To process your recent post more efficiently, I created a separate ticket on your behalf: T171370: Attached files are not shown in RichEditControl after implementing the approach demonstrated in the E4911 example. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to calculate a route between waypoints and customize the appearance of a route path using a Microsoft Bing Route web service

$
0
0

This example demonstrates how to calculate a route between several waypoints and change the appearance of a route path by means of the Microsoft Bing Route web service.

To calculate a route between waypoints, call the BingRouteDataProvider.CalculateRoute method and pass a list of waypoints as its argument.

To customize the route path appearance, do the following:

- Handle the BingRouteDataProvider.RouteCalculated event;
- Access the route path using the RouteCalculationResult object inside the BingRouteDataProvider.RouteCalculated event handler's BingRouteCalculatedEventArgs;
- Create a MapPolylinewith calculated route points. To access the route points collection, use the BingRouteResult.RoutePath property;
- Customize the stroke and stroke width of the map polyline using the MapItem.Stroke and MapItem.StrokeWidth properties.

The map pushpins are generated automatically at each route waypoint position because the InformationDataProviderBase.GenerateLayerItemsproperty is set to true by default. Note that the pushpins' text contains an empty string.
To number route waypoints (from start to finish) in the pushpin, handle the InformationDataProviderBase.LayerItemsGeneratingevent and modify the MapPointer.Text property.

Note that if you run this sample as is, you will get a warning message saying that the specified Bing Maps key is invalid. To learn more about Bing Map keys, please refer to the How to: Get a Bing Maps Keytutorial.


Question Comments

Added By: Daz at: 11/11/2014 3:07:44 AM    

This should be updated as it uses obsolete properties

Added By: Constant (DevExpress Support) at: 11/11/2014 3:57:12 AM    Thank you for your note. We will update the example soon. 

How to create a single-page report to print a document on roll paper

$
0
0

This example demonstrates how to calculate the resulting report height and change its page size to place the report content into a single page. To accomplish this, create a document using the XtraReport.CreateDocument method, change the document page settings so the document contains a single page, and then adjust the page height by calculating the total height. The first adjustment is required to remove redundant Page headers and footers to calculate the resulting height more precisely.

Question Comments

Added By: George (DevExpress) at: 11/11/2014 5:29:26 AM    

With the 14.2 release, it has become possible to optimize a report for printing on roll paper by setting a single RollPaper property.

How to sort a ASPxPivotGrid by clicking on a field value

$
0
0

The PivotGrid allows sorting by any column. To do this, right click any field value and select an appropriate field to sort by it. Sometimes it is possible to sort by any column by simply clicking on it. This example shows how to implement this behavior. You should create a template for field values to place a hyperlink (or a button) rather than a plain text.

[C#]
ASPxPivotGrid1.FieldValueTemplate=newFieldValueTemplate(ASPxPivotGrid1);

The FieldValueTemplate class should implement the ITemplate interface. We've replaced standard contents of a field value in the InstantiateIn method.

[C#]
publicclassFieldValueTemplate:ITemplate{publicFieldValueTemplate(ASPxPivotGridpivotGrid){this.pivotGrid=pivotGrid;}ASPxPivotGridpivotGrid;protectedASPxPivotGridPivotGrid{get{returnpivotGrid;}}#regionITemplateMemberspublicvoidInstantiateIn(Controlcontainer){PivotGridFieldValueTemplateContainerc=(PivotGridFieldValueTemplateContainer)container;HyperLinklink=newHyperLink();link.Text=(string)c.Text;link.NavigateUrl="#";link.Attributes["onclick"]=GetOnClickHandler(c);c.Controls.Add(link);boolisSortedByColumn=GetIsSortedByColumn(c);if(isSortedByColumn){c.Controls.Add(newLiteralControl("&nbsp;*"));}}#endregionboolGetIsSortedByColumn(PivotGridFieldValueTemplateContainerc){List<PivotGridFieldPair>sortedFields=PivotGrid.Data.VisualItems.GetSortedBySummaryFields(c.ValueItem.IsColumn,c.ValueItem.Index);boolisSortedByColumn=sortedFields!=null&&sortedFields.Count> 0;returnisSortedByColumn;}stringGetOnClickHandler(PivotGridFieldValueTemplateContainerc){StringBuilderres=newStringBuilder();res.Append(pivotGrid.ClientInstanceName).Append(".PerformCallback('SC|");res.Append(GetFieldIndex(c)).Append("|").Append(c.ValueItem.IsColumn).Append("|").Append(c.ValueItem.VisibleIndex).Append("|").Append(c.ValueItem.DataIndex);res.Append("');");returnres.ToString();}intGetFieldIndex(PivotGridFieldValueTemplateContainerc){returnc.ValueItem.Field!=null?c.ValueItem.Field.Index:-1;}}

The GetOnClickHandler method returns a javascript code that will perform a ASPxPivotGrid's callback passing all required parameters to the server. On the server side, you should handle the CustomCallback event handler and apply sorting to it.

[C#]
protectedvoidASPxPivotGrid1_CustomCallback(objectsender,PivotGridCustomCallbackEventArgse){string[]args=e.Parameters.Split('|');if(args[0]=="SC")HandleSortByColumnClick((ASPxPivotGrid)sender,args);}voidHandleSortByColumnClick(ASPxPivotGridpivotGrid,string[]args){intfieldIndex=int.Parse(args[1]),visibleIndex=int.Parse(args[3]),dataIndex=int.Parse(args[4]);boolisColumn=bool.Parse(args[2]);PivotAreaarea=GetArea(isColumn),crossArea=GetCrossArea(isColumn);PivotGridFielddataField;List<PivotGridField>fields;List<object>values;GetFieldsAndValues(pivotGrid,fieldIndex,visibleIndex,dataIndex,area,outdataField,outfields,outvalues);SetSortByColumn(pivotGrid,crossArea,dataField,fields,values);}

Sorting can be set by filling the SortBySummaryInfo structure. The BeginUpdate/EndUpdate method calls are necessary to prevent multiple data recalculations.

[C#]
voidSetSortByColumn(ASPxPivotGridpivotGrid,PivotAreacrossArea,PivotGridFielddataField,List<PivotGridField>fields,List<object>values){pivotGrid.BeginUpdate();List<PivotGridField>crossFields=pivotGrid.GetFieldsByArea(crossArea);for(inti= 0;i<crossFields.Count;i++){crossFields[i].SortBySummaryInfo.Field=dataField;crossFields[i].SortBySummaryInfo.Conditions.Clear();for(intj= 0;j<values.Count;j++){crossFields[i].SortBySummaryInfo.Conditions.Add(newPivotGridFieldSortCondition(fields[j],values[j]));}}pivotGrid.EndUpdate();}
Question Comments

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

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

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

This code didn't work for me

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

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

GridView - How to implement date range filtering using a custom editor in the AutoFilterRow

$
0
0

This example demonstrates how to implement date range filtering in the GridView extension.
Use the MVCxGridViewColumn.SetFilterTemplateContent  method to create a custom editor and assign a delegate method to the GridViewSettings.ProcessColumnAutoFilter property to process a custom filter expression sent from the client side.
See also:
E1990: Date range filtering in the Filter Row

Question Comments

Added By: Gustavo Sainz at: 11/11/2014 11:08:43 AM    

I can't make it to work, as the ProcessColumnAutoFilter does not trigger when settings the grid to use

 settings.CustomBindingRouteValuesCollection.Add(GridViewOperationType.Filtering, new { Controller = "ViewDate", Action = "AdvancedCustomBindingFilteringAction", key = "-1" });

Any idea how to resolve this?

Added By: Vladimir (DevExpress Support) at: 11/11/2014 10:25:08 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T171947: The ProcessColumnAutoFilter does not trigger. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.


How to show MemoExEdit content in its text field

$
0
0

This example demonstrates how to create an editor that allows displaying multiline text in its text field and edit content in the popup form.

In this example we have created a RepositoryItemMemoExEdit descendant with an additional Memo property. The Memo property is a RepositoryItemMemoEdit object. It is used to draw the editor content.

This example is based on the CustomEditor : How to create a custom ButtonEdit that allows displaying RTF/HTML readonly content example.


Question Comments

Added By: M Parker at: 11/11/2014 11:19:35 AM    

I like the idea of this example, but I do not see a Form1.Designer.cs file that would show me how to use the control.

Added By: Jannet (DevExpress Support) at: 11/11/2014 10:48:16 PM    Hello,
I've made necessary changes and now you can see the file. Please check this point.
Please note that you can always download the compiled project to see this solution in action. 

For more information about our Code Central, refer to Mehul's blog at https://community.devexpress.com/blogs/aspnet/archive/2008/07/30/codecentral-source-code-to-search-download-run-enterprise-cheat.aspx.

Feel free to contact me if you have additional questions.

How to calculate PercentVariation and AbsoluteVariation in a custom direction (e.g. from right to left)

$
0
0

This example shows how to use the PivotGridControl.CustomCellDisplayText or PivotGridControl.CustomCellValue event to display a field values as if its PivotGridFieldBase.SummaryDisplayType property is set to PercentVariation, but the values are read in the reverse direction (from right to left).

To accomplish this task, you should create a new PivotGridField, bind it to the DataField, and hide the grand totals for this field via the PivotGridFieldOptions.ShowGrandTotal property. After that, you will need to manually calculate a display text for this field in the CustomCellDisplayText or CustomCellValue event, as shown in the example project.

How to use jQuery to drag and drop items from one ASPxGridView to another

$
0
0

The example demonstrates how to use the jQuery framework to drag an item from one grid to another.

- Use jQuery UI Draggable and Droppable plug-ins;
- Define "draggable" and "droppable" items:

[ASPx]
<Styles><TableCssClass="droppableLeft"></Table><RowCssClass="draggableRow left"></Row></Styles>

 - Use the invisible ASPxGlobalEvents control and handle its client-side ControlsInitialized/EndCallback events;
- Initialize the defined draggable/droppable items via the corresponding jQuery selectors. The "start" event handler can be used to obtain the key of the dragged row and apply conditional styling to it:

[JScript]
start: function(ev, ui){var $sourceElement = $(ui.helper.context);var $draggingElement = $(ui.helper); //style elements $sourceElement.addClass("draggingStyle"); $draggingElement.addClass("draggingStyle"); //find keyvar sourceGrid = ASPxClientGridView.Cast($draggingElement.hasClass("left") ? "gridFrom" : "gridTo"); rowKey = sourceGrid.GetRowKey($sourceElement.index() - 1);}

- Handle the "drop" event of the "droppable" items and perform a callback to the callback panel that has both grids nested inside to perform the data editing functionality.

Select the "script.js" source file and review the comments to find an illustration of the above steps.


See Also:
T116869: GridView - How to drag and drop items from one grid to another
E4582: How to reorder ASPxGridView rows using buttons or drag-and-drop

Question Comments

Added By: Marc Michaels at: 1/16/2013 6:03:17 AM    

Where is DX.ashx? I can't find any mention of it anywhere.

Added By: Marc Michaels at: 1/16/2013 6:14:32 AM    

<div class="draggable"> ??? Can't find this anywhere in the example as well. This example really leaves me in the dark there is no explanation of anything. Sadly it's the closest thing I can find to help me drag from one grid and drop on another. Just going to have to struggle through it.

Added By: Marc Michaels at: 1/16/2013 6:21:13 AM    

Running example simply results in "The resource cannot be found".

Added By: Mark OMeara at: 8/19/2014 6:59:25 PM    

Can this example be adjusted to also drag and drop within the same grid? i.e. for ordering of rows?

Added By: Anthony (DevExpress Support) at: 8/20/2014 5:18:06 AM    

Hi Mark,

We have the How to reorder ASPxGridView rows using buttons or drag-and-drop example that shows how to reorder grid rows using the same jQuery UI library. Please use the approach from it to accomplish your task.

Added By: Nicholas Mattiello at: 11/12/2014 7:27:44 AM    

Can you post the code for the Helper class used in the code behind of Default.aspx?

How to populate ComboBoxEdit with enumeration elements

$
0
0

To bind ComboBoxEdit to an enum, use the EnumItemsSource markup extention in the following manner:

[XAML]
<dxe:ComboBoxEditItemsSource="{dxe:EnumItemsSource EnumType=local:MyEnum}"/>

For version 13.1 and earlier:
All logic is encapsulated in the BaseComboBoxStyleSettings descendant which is defined in the MyComboBoxStyleSettings.cs(vb) file. The representation of items in the popup window depends on the enumeration items kind. E.g., if enumeration items have description attributes they will display the description text instead of item names. If the enumeration definition is decorated with the FlagsAttribute attribute, items will be represented as check editors with the TextBlock element used as description.

Question Comments

Added By: Marcin Sulecki at: 11/13/2014 5:33:39 AM    

I has just Description attribute to MyEnum but ComboBoxEdit displays item names instead description. I use version 14.1

public enum MyEnum
   {
       [Description("Eating")]
       Eat,

       [Description("Sleeping")]
       Sleep,

       [Description("Coding")]
       Code
   }

I count on your help.

Added By: Ilya (DevExpress Support) at: 11/13/2014 6:52:34 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T173028: How to display description of an enum item when EnumItemsSource is used in ComboBoxEdit. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to display binary images (data URIs) in the dxGallery widget or a dxList template

$
0
0

To display binary images in the dxGallery widget or a dxList item template, encode your image byte array in base64 and use the Data URI scheme. In this case, all the processing will be done on the client side and your image elements inside the dxList template will look as follows:

[HTML]
<imgdata-bind="attr: { src: 'data:image/png;base64,' + your_image_bytes_in_base_64}"/>

You can use the following tools to convert any image into a base64 string:

DevExpress - How to convert a binary image to a base64 string
Motobit
DataURL

Question Comments

Added By: albert chang 1 at: 11/13/2014 1:32:40 AM    

<img id="imgID" data-bind="attr: { src: 'data:image/png;base64,' + getpicture(id) }"

getpicture= function(id){
var no_seq1 = id;
        $.ajax({
    url: 'http://localhost:48785/WebService1.asmx/PublishImage';,
            data: '{id: ' + JSON.stringify(no_seq1) + ' }',
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            type: "POST",
            async: false,
            error: function (xml, status) {
                return status;
            },
            success: function (result) {
var img = result.d;  
}
}

Q:

1. how to return base64 string (img) to dxList image control
2. jQuery("#imgID").attr("src", img); --> only display last one record

thanks

Added By: Nikolai (DevExpress Support) at: 11/13/2014 7:32:22 AM    

Hello Albert,

To process your recent post more efficiently, I created a separate ticket on your behalf: T173067: How to display binary images (data URIs) in the dxGallery widget or a dxList template. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

LookUpEdit - Processing New Values

$
0
0

This example shows how to manually initialize a new value and add it to a data source.

Update:

Starting with version 13.1 of DevExpress controls, you can use the DevExpress MVVM Framework to accomplish this task. It is necessary to create a command in the view model (for instance, the ShowProductFormCommand command) and bind it with the LookUpEditBase.ProcessNewValue event via the trigger. This would allow you to display the dialog (UserControl1.xaml file) for editing new source items in the LookUpEdit control when this even is raised. Then, you can implement custom logic in the OnShowProductFormCommandExecute (ProductList.cs file) method to process values in this dialog.


Please review our blogs to find additional information about DevExpress MVVM Framework:

Getting Started with DevExpress MVVM Framework. Commands and View Models.
DevExpress MVVM Framework. Introduction to Services, DXMessageBoxService and DialogService.
DevExpress MVVM Framework. Interaction of ViewModels. IDocumentManagerService.

Question Comments

Added By: Sorin Sandu at: 7/10/2012 8:47:32 AM    

Hi
Is it possible to close the popup before showing the dialog ?

Added By: Raumnz at: 9/25/2013 10:29:32 AM    

hi
once entered the new value on the product name, I tab . should the lost focus open the new tab?

thanks.
PD. I have to click outside the control for the pop up to show.

Added By: Matthias Adloff at: 11/14/2014 2:05:51 PM    

Would you mind to translate this example to POCO?

How to merge cells horizontally in GridView

$
0
0

This example demonstrates how to merge cells located in the same row. The main idea is to paint merged cell manually.
You can find a helper class in this example, which can be easily connected to your existing GridView.

Question Comments

Added By: John Nyari at: 9/16/2013 9:57:18 AM    

Hi - all leads for horizontal merging seem to lead here. I have integrated it and found it works very well. However I seem to get a crash if the cells its merging are cells that have already been merged vertically. I am running v2012 12.2.8. Thanks

Added By: Maxim (DevExpress Support) at: 9/16/2013 11:32:16 PM    

Hello John,

I have opened a separate issue on your behalf:

Application crash when using an approach from the E2472 example and merging cells horizontally

Please refer to this report for further correspondence on this item.

Added By: Chris Janssen 1 at: 12/18/2013 12:17:48 PM    

It also crashes if you merge cells cells that have different types of data in them (merge a cell with an integer and a cell with a string)

Added By: Chris Janssen 1 at: 12/18/2013 12:30:39 PM    

After more testing It seems to crash because of an infinite loop.

        If _view.GetRowCellValue(rowHandle, column) isNot value Then
            _view.SetRowCellValue(rowHandle, column, value)
        End If

The above code doesn't work when comparing integers, it always says they're different, so it keeps changing the value and getting called infinitely. When changed to

        If _view.GetRowCellValue(rowHandle, column) <> value Then
            _view.SetRowCellValue(rowHandle, column, value)
        End If

it works.

Added By: HansG at: 1/2/2014 9:30:55 AM    

I think there is an error in addMergedCell:
The desired value of the cell is not put in the mergedCell list. This is, because the AddMergedCell with the integers as parameters does not use the AddMergedCell variant with "value".
To fix this add parameter "value" to the call of AddMergedCell in MyCellMergeHelpler.cs.
This will also fix the view of the strings, that where defined in Form1().

Alternativly don ́t use .absoluteIndex and just use the columns.

Added By: Dan Nordin at: 10/6/2014 7:12:40 PM    

Hi, thanks for this example.  The only problem I have with it is when you convert your grid over OptionsView.AutoColumnWidth = false and then scroll over so that one of the merged columns starts to disappear off the left side of the grid, it ends up covering up the Indicator column.  Likewise if you scroll so the columns start to disappear off the right they end up covering about 1 pixel of the frame of the grid on the right side of the scrollbar (the far side of it).  If this could be remedied in the example that would be a huge help to me because I need to implement this in a big grid with lots of scrolling.  Thanks.

Added By: Demetrius (DevExpress Support) at: 10/7/2014 2:49:26 AM    

Hi Dan,

I need to clarify some details to process your recent post more efficiently. I have created a separate ticket on your behalf: E2472 - Merged cells disappear while scrolling. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.


How to: Create a QRCode BarCodeControl

$
0
0
This example demonstrates a BarCodeControl with the QRCode symbology.

Updating a Grid datasource from a separate thread

$
0
0

This example shows how to properly update the Grid's underlying data source from a background thread, and avoid possible synchronization problems.

See Also:
Can I avoid the ArgumentOutOfRangeException when updating the Grid's data

Question Comments

Added By: Rongchen Jia at: 8/22/2013 12:51:30 AM    

hi, i can see that you are updating a copy of the datasource and then rebind grid's datasouce to the new update.
I am wondering wont it be more efficient instead of doing
gridControl1.BeginInvoke(new MethodInvoker(delegate { gridControl1.DataSource = clone; }));
we do
gridControl1.BeginInvoke(new MethodInvoker(delegate { FillData(data, deleting); deleting=!=deleting}));

is there any problem in updating the DataTable data object directly on UI thread?

Added By: Gosha (DevExpress Support) at: 8/30/2013 10:50:31 AM    

Hi Rongchen,

The main idea of updating the Grid data source from a background thread is that a long operation does not block the UI thread. If you update the data source in the UI thread, it will be blocked while the data source is being updated. So, there is no benefit in this approach.

Added By: Nikesh Parakh at: 11/15/2014 7:58:21 AM    

I am using same  code which you have mention below using thread but still mine
View_ShownEditor(object sender, EventArgs e) is not calling which I am clicking on grid cell.

ASPxGridView - How to specify the CommandButtons’ and Custom CommandButtons’ properties based on any custom criteria

$
0
0

The example demonstrates how to specify the CommandButtons and Custom CommandButtons properties by handling the CommandButtonInitialize and CustomButtonInitialize events. The DataRows' VisibleIndex property and criteria set based on field values are used to determine the buttons' visibility.

Question Comments

Added By: Hans Leonhardt at: 11/16/2013 9:27:49 AM    

Just as an addition:
If you're Using an Entity e.g. an EntityDatasource this fails. This will work, e.g.

 Private Function DeleteButtonVisibleCriteria(ByVal grid As ASPxGridView, ByVal visibleIndex As Integer) As Boolean
  
     Dim row As NameOfYOurEntity = ASPxGridView1.GetRow(visibleIndex)
       ' e.g: The Entity has a boolean Property named "isAdmin"
     Return row.isAdmin
   
 End Function

Added By: Jean-Luc Praz at: 11/17/2014 6:24:59 AM    

Is there a way to find out if a row is the first or last row in a Grid ? I need to hide a button based on that criteria ?

Added By: Alessandro (DevExpress Support) at: 11/17/2014 7:47:58 AM    Hi,

I will create a separate ticket on your behalf to keep this web page simple: ASPxGridView - E3028 - Check row location. Thank you for your time and cooperation in advance.

How to display check boxes for legend items to control the visibility of series in the unbound mode

$
0
0

This example demonstrates how you can provide each legend item with a check box, which controls the visibility of the corresponding series in the unbound mode.
Note that starting with the DXperience version 13.2.1, the chart control supports a built-in check box in the Legend feature. For more details, see the Legend Check Box topic.  

Implementation details for the DXperience v2012 vol 2.5

To accomplish this, it is necessary to assign the Legend.Template property to custom template and then bind the ItemsSource property of the ItemsControl object to SeriesNonVisualWrappersCollection.

This custom collection is synchronized with the diagram's series collection when the SeriesCollection.CollectionChanged event fires.

In addition, the fake series is created to avoid hiding the legend when the Series.Visible property is set to false for all series.

See also:
- How to display custom information in the legend;
- How to customize chart titles;
- How to display check boxes for legend items, to control the visibility of series in the bound mode.

Question Comments

Added By: Zeljko Ilic at: 11/17/2014 6:57:42 AM    

This is working great - there is just one thing: there is no color on clickable chart legend.
Since each check item corresponds to one curve, ideally they should be having the same color.
Can this be added?

Added By: Alex (DevExpress Support) at: 11/17/2014 11:55:22 PM    Hi Zeljko,

In the latest version (v14.1), this functionality is supported out of the box (see the Legend Check Box article). Please upgrade your application to a more recent version and let me know if you need any clarification.

ASPxGridView - Batch Edit - How to change an editor's server-side properties based on the key value

$
0
0

This example illustrates how to change an editor's server-side properties based on the key value if ASPxGridView uses the Batch Edit mode. ASPxMemo placed inside the C3 column has different MaxLength for different rows: MaxLength = 4 for rows with the odd ID and 10 for rows with the even ID. 

Note: this example is created based on the ASPxGridView - Batch Editing - A simple implementation of an EditItem template one. You can refer to this example to get information about the implementation of the ASPxGridView's EditItem template in BatchEdit mode.  

Viewing all 7205 articles
Browse latest View live


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