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

How to programmatically generate ObjectDataSource and map object data source constructor parameters to report parameters


How to show tooltips for map shapes

$
0
0

This example illustrates how to display tooltips for shapes loaded from Shapefiles (Countries.dbf, Countries.shp).

Note that a tooltip displays information (a country name, population) for each map shape from Shapefiles.

Question Comments

Added By: Christian Weber 4 at: 8/17/2016 3:54:30 AM    Do you happen to have further information about TooltipPattern and what values make sense?
Added By: John (DevExpress Support) at: 8/17/2016 6:57:39 AM    Hi Christian,
I have created a separate topic for your recent comment on your behalf: Documentation - describe the TooltipPattern property functionality in greater detail. Let's continue our discussion there.

WPF End-User Report Designer - How to register a custom control in the Designer's toolbox

ASPxSpreadsheet - How to implement a custom footer displaying total summaries

$
0
0

This example demonstrates how to implement a footer with total summaries like in MS Excel:



Please enter several values into ASPxSpreadsheet and select them with the mouse or pressing the SHIFT key:

How to: Bind a Report to an Excel Workbook at runtime

$
0
0

This code example demonstrates how to create a new blank report at runtime (an instance of the XtraReport class), bind it to a Microsoft Excel workbook, and then, fill the report with a DetailBand containing an XRLabel to show data from this workbook.

To bind a report to an Excel data source, create a new instance of the ExcelDataSource class and specify the full path to the source Excel file using the FileName property. Then, specify required settings used to extract data from the workbook and manually define the data source schema. Finally, assign the created data source to the report using the DataSource property.

In this example, an XRLabel is added to the report to display data of one data field.

OBSOLETE - How to represent a enumeration property via radio buttons or check boxes on the Web

$
0
0

==========================================================
This example is now obsolete. Refer to the How to represent an enumeration property via a drop-down box with check boxes one instead.
==========================================================

This example demonstrates how to implement property editors using our ASPxCheckBox and ASPxRadioButton controls to manage simple enumeration and flags properties:

[C#]
[Flags]publicenumComboboxEnum{None= 0,Value1= 1,Value2= 2 };publicenumRadioButtonEnum{Value1,Value2};[DefaultClassOptions]publicclassSampleObject:BaseObject{publicSampleObject(Sessionsession):base(session){}privateComboboxEnum_comboboxEnumProperty;publicComboboxEnumComboboxEnumProperty{get{return_comboboxEnumProperty;}set{SetPropertyValue("ComboboxEnumProperty",ref_comboboxEnumProperty,value);}}privateRadioButtonEnum_radioButtonEnumProperty;publicRadioButtonEnumRadioButtonEnumProperty{get{return_radioButtonEnumProperty;}set{SetPropertyValue("RadioButtonEnumProperty",ref_radioButtonEnumProperty,value);}}}

See Also:
Display a Property Via the Required Editor
Implement Custom Detail View Item
How to: Implement a Property Editor for a Web Site
How to: Implement a Property Editor for Windows Applications
How to bind a control in EditForm template to XPObject enumerable field

Question Comments

Added By: Sandro Welter (Intelligix) at: 11/8/2012 12:24:10 PM    

How to set this example as favorite?

Added By: Mohamed AIT LAHMID at: 2/21/2013 5:37:39 AM    

Thank you for your help.

I used RadioButtonEnumPropertyEditor :

        [Flags]
        public enum TopRecherche { Taxe = 0, Redevable = 1, LieuImposition = 2 };
         //..
        TopRecherche topRecherche;
        [ImmediatePostData]
        [ModelDefault("PropertyEditorType", "iclRegie.Module.Web.Editors.RadioButtonEnumPropertyEditor")]
        public TopRecherche TopRecherche
        {
            get { return topRecherche; }
            set
            {
                if (!IsLoading && !IsSaving && value != topRecherche)
                {
                    redevable = null;
                }
             }
        }
        p_Redevables redevable;
        [ImmediatePostData]
        public p_Redevables Redevable
        {
            get { return redevable; }
            set
            {
                SetPropertyValue<p_Redevables>("Redevable", ref redevable, value);
            }
        }

But the value of the property 'Redevable' is not changed when i changed the value of 'TopRecherche' in web page.

Added By: Sabine Dijt at: 8/27/2013 2:40:20 AM    

If I add more options to the enum it doesn't save right. It automatically checks every other option.
I'm using v13.1.5 btw. Is there any reason it wouldn't work in this version?

Added By: MohammedFarooq at: 11/20/2013 8:55:09 AM    

Can you post the equivalent code for v2013 vol 1.8?

Added By: Pauline Abou haidar at: 9/3/2014 4:20:12 AM    

Hi,
Please for the lines
radioButton.CheckedChanged += New EventHandler(AddressOf radioButton_CheckedChanged)

radioButton.CheckedChanged -= New EventHandler(AddressOf radioButton_CheckedChanged)

i need the equivalent in vb.net

and why if i put immediatepostdata= true for a property of radiobuttonenumpropertyeditor, it refreshes the selected value to the default every time i try to choose one.

Thanks and best regards

Added By: Dennis (DevExpress Support) at: 9/3/2014 12:43:26 PM    

@Pauline:

Hese is the VB.NET code you are looking for:

[VB.NET]
AddHandler radioButton.CheckedChanged, AddressOf radioButton_CheckedChangedRemoveHandler radioButton.CheckedChanged, AddressOf radioButton_CheckedChanged

  

As for the behavior you described, it looks like an issue in this implementation. However, it is now obsolete and we no longer support this example code. I suggest you refer to the latest example mentioned in example's description.

Added By: pardha saradhi 1 at: 8/18/2016 6:51:57 AM    Hi,
Iam new to this devexpress XAf framework.Currently iam using Xaf 16.1 version.

Now my requirement is to create radiobuttonlist (group of radio buttons will be shown in  "popupWindowShowAction1"  popup).

Iam using 16.1 devexpress licence vers ion still getting issues with this change. I need "Radio button propertyEditor.cs" and how to use in our properties.


Thanks,
Pardha Saradhi.V

How to: Bind a Report to a CSV file at runtime

$
0
0

This code example demonstrates how to create a new blank report at runtime (an instance of the XtraReport class), bind it to data obtained from a CSV file, and then, fill the report with a DetailBand containing an XRLabel to show data from this file.

To bind a report to a CSV file, create a new instance of the ExcelDataSource class and specify the full path to the source file using the FileName property. Then, specify required settings used to extract data from the file and manually define the data source schema. Finally, assign the created data source to the report using the DataSource property.

In this example, an XRLabel is added to the report to display data of one data field.

ASPxGridView - how to create a multilevel master-detail grid dynamically

$
0
0

This example illustrates how to load content into the GridViewDetailRowTemplate container dynamically and bind it to a dynamical datasource

Question Comments

Added By: Sree Chitoor at: 8/18/2016 8:21:30 AM    Thanks for your short reply...

Our requirement is to create child rows in the parent row so currently the link which is shrared with us seems single level row but we required child rows for the same grid.

As of now we required three levels child row for a parent row again the child row should be dynamically created based on the Parent ID.

Please let us know if any further clarification waiting for your quick reply...

Thanks Added By: Lex (DevExpress Support) at: 8/18/2016 9:00:59 AM    

Hello Sree,

It seems that you wanted to post a comment in the ASPxGridView - Dynamic datasource with child level ticket. I've moved it to the corresponding thread. Let's continue our discussion there.


How to change a label's appearance in its BeforePrint event handler

$
0
0

This example demonstrates how to handle a label's BeforePrint event, how to access a label object in this event handler, and how to customize its appearance according to some certain condition.

Question Comments

Added By: Steve Coleman 2 at: 8/18/2016 10:26:15 AM    How do you change the value based on the current row\cell?Added By: Yaroslav (DevExpress Support) at: 8/18/2016 2:17:30 PM    Hi Steve,
I've answered your question in the Export grid with images XtraReport to pdf thread. Let's continue our conversation there.

WPF End-User Report Designer - How to customize the Ribbon toolbar

$
0
0

This example demonstrates how you can customize the Report Designer control's toolbar. In particular, it shows how to remove standard toolbar controls and add custom ones. 

To accomplish this, use the Designer's RibbonCustomizationActions property, which specifies a collection of actions used to customize the Designer's ribbon toolbar.  These actions allow you to remove existing items or add new items both in the designer and preview pages.

Document Viewer - Ribbon - How to customize the list of export formats

ASPxDocumentViewer - How to implement a custom toolbar

ASPxDocumentViewer - How to refresh a control inside an ASPxCallbackPanel

ASPxReportDesigner - How to register a custom control in the Designer's toolbox

$
0
0
This example shows how to create a custom control and register it in the Web Report Designer's Toolbox. The example illustrates the steps to expand a set of native report controls by deriving from existing ones.

How to create custom report controls

$
0
0

This example demonstrates how to create a custom ProgressBar control.

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

See also:
ASPxReportDesigner - How to register a custom control in the Designer's toolbox
WPF End-User Report Designer - How to register a custom control in the Designer's toolbox
How to create complex custom controls (XRTreeList and XRGrid)

Question Comments

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

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

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

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

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

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

Regards, Wolfgang

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

Hi Wolfgang,

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

Added By: Justyn Laufenberg at: 10/14/2014 1:35:29 PM    

When the report is saved and loaded again, if max value was set to something besides 100, it doesnt save. Is there a way to get the properties to save as part of the xml? I am using the end user side of reports and need the custom properties to save when 'SaveLayoutToXml' is called.

Added By: Ingvar (DevExpress Support) at: 10/15/2014 1:27:43 AM    Hi Justyn,

Make sure that you have marked your properties with the XtraSerializableProperty attribute.

See also:
XML SerializationAdded By: Justyn Laufenberg at: 10/15/2014 8:06:27 AM    

Awesome, easy fix. For others reference.

       [DefaultValue(100), XtraSerializableProperty]
       public float MaxValue {
           get { return this.maxVal; }
           set {
               if (value <= 0) return;
               this.maxVal = value;
           }
       }

Added By: Justyn Laufenberg at: 10/15/2014 9:21:19 AM    

Another Question, how do we set what the display name of the control will be in the toolbox?

For the properties, I was able to do the following.
[DisplayName("Max Value")]
[Description("The max value of the bar.")]

But the same doesn't work for the control. I would like it to say "Progress Bar".  Currently, I am doing the following but is a little tedious and would like to know if there is a better way.
ToolboxItem progressBar= new ToolboxItem(typeof(ProgressBar));
progressBar.DisplayName = "Progress Bar";
ts.AddToolboxItem(progressBar, "Custom");

Thank You.

Added By: Ingvar (DevExpress Support) at: 10/16/2014 12:19:18 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T161885: How to define the Control display name in the Toolbox. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.


How to use ASPxCheckBox in DataItemTemplate to emulate a selection

$
0
0

The Selection behavior is emulated by the ASPxCheckBox. Client-side events are set at runtime. The checkbox uses the ASPxClientGridView.SelectRowOnPage to set a row, where it is placed.

This example shows ho to improve formatting, when it is necessary to place controls inside a command column in the appropriate layout.

See Also:
How to select a row in one click
How to hide ASPxGridView's SelectionCheckBox for particular row

Question Comments

Added By: DevExpressuser777 at: 5/6/2013 12:18:15 AM    

Good one but when I select all check boxes individually the header is not getting selected, similarly when I click on header and select all, after unchecking a checkbox the header selection is showing in selected state only

Added By: Sandeep Agarwal 3 at: 8/19/2016 11:20:25 AM    I've a problem with this implementation where if the user has checked some rows in the grid and then they click anywhere outside on any other row the checked rows loses it highlight and when we call the GetSelectedFieldValues() function on the server, it only returns the last highlighted item and not the previously checked rows. Any idea how can this be prevented ?.

ASPxComboBox: Three Different Methods to Create ToolTip for ComboBox Items

$
0
0

This example demonstrates how to create a tooltip for each ComboBox item. In the first pair of ASPxComboBoxes, items are read from the database and converted from plain text to HTML code (<span title=’Description’>CategoryName</span>). In the third ComboBox, its items are added at runtime using the ASPxComboBox.Items.Add method. Please note that it's necessary to use this method with 2 parameters: text and value separately, otherwise the HTML string will be used as a value of an7 item and will be sent to the server on a callback. In this case, ASP.NET environment automatically stops the execution of server-side operations and raises HttpRequestValidationException.
The “EncodeHtml” property of ASPxComboBox is set to “false” to guarantee that the HTML code is executed.

In the first and third methods, the HTML code is created on the server side in the “ASPxComboBox_Init” event.

In the second method, the HTML code is created by modifying the select command of the data source.

OBSOLETE - Custom Functions

$
0
0

This solution is obsolete. Refer to theHow to: Implement a Custom Criteria Language Operator article for a recommended solution.

Database engines provide specific functions that aren't implemented in XPO. XPO still allows you to call such a function by creating a custom ConnectionProvider class and overriding its FormatFunction method. This example shows how to use the T-SQL DATEPART function in your XPO projects. Please pay attention to the Northwind.Order.OrderMonth property in the Northwind module and to the CustomCommand.MyMsSqlConnectionProvider.FormatFunction method in MyMsSqlConnectionProvider.

This sample requires MS SQL Server or SQL Express with a Northwind demo database.

See Also: How to implement the ICustomFunctionOperatorFormattable interface

How to implement the ICustomFunctionOperatorFormattable interface

$
0
0

This example is a modified version of the E207 example. Starting from version 9.2 we implemented the ICustomFunctionOperatorFormattable interface. Now, there is no necessity to create a custom connection provider to implement custom functions. All that you need is to create a class implementing the ICustomFunctionOperatorFormattable interface.

The ICustomFunctionOperatorFormattable interface defines following members:

Name - should return the name of the custom function. This name should be passed as a first operand to a FunctionOperator constructor:

[C#]
FunctionOperatorop=newFunctionOperator(FunctionOperatorType.Custom,"MyFunction",operandA,operandB);// orCriteriaOperatorop=CriteriaOperator.Parse("custom('MyFunction', ?, ?)",operandA,operandB);
[VB.NET]
Dim op AsNew FunctionOperator(FunctionOperatorType.Custom, "MyFunction", operandA, operandB)' orDim op As CriteriaOperator = CriteriaOperator.Parse("custom('MyFunction', ?, ?)", operandA, operandB)

ResultType - should return the type of the result value.

Format - this method should return the SQL command. The providerType parameter allows you to provide the different implementation for each SQL provider, if they use different SQL syntax for the operation you want to implement.

Evaluate - this method allows you to provide the client side implementation of the custom function.

Please note that you should register the custom function operator using the ConnectionProviderSql.RegisterCustomFunction method, and add it to the XPDictionary.CustomFunctionOperators collection.

Remark:
The code above demonstrates the old syntax: "custom('MyFunction', ?, ?)"
Starting from version 10.2, a more intuitive syntax can be used: "MyFunction(?, ?)"

In addition to the ICustomFunctionOperatorFormattable interface, the custom function can implement the ICustomFunctionOperatorQueryable interface. This function can be used in LINQ to XPO queries.

The ICustomFunctionOperatorQueryable interface defines one method: GetMethodInfo. This method should return the MethodInfo instance that will be used to find the custom function in the dictionary. The method name should match the custom function name, because LINQ to XPO will search the custom function using the method name. Use of the custom function in the LINQ to XPO query is shown below:

[C#]
varlist=fromoinnewXPQuery<Order>(session)whereo.OrderName=="Chai"selectnew{Month=GetMonthFunction.GetMonth(o.OrderDate)};
[VB.NET]
'This code snippet uses implicit typing. You will need to set 'Option Infer On' in the VB file or set 'Option Infer' at the project level:Dim list = _From o InNew XPQuery(OfOrder)(session) _Where o.OrderName = "Chai" _SelectNewWith {Key .Month = GetMonthFunction.GetMonth(o.OrderDate)}

It is necessary to register custom functions using the ConnectionProviderSql.RegisterCustomFunctionOperator method, and add them to the XPDictionary.CustomFunctionOperators collection.

See Also:
How to: Implement a Custom Criteria Language Operator 
How to: Implement Custom Functions and Criteria in LINQ to XPO


How to use an unbound check box column to select grid rows

$
0
0

From version 13.2, the GridView in the XtraGrid control provides a built-in checkbox column for multiple row selection.
This feature is demonstrated in the example that targets version 13.2. Additional information can be found in the following topic: Multiple Row Selection via Built-In Check Column

If you are using an earlier version of DevExpress controls, see the attached example that targets this earlier version.
This example demonstrates a method to manually create a check column for row selection. The example is similar to the one from the A371 article. The difference is that this example employs the grid's built-in multi-selection and keeps it in sync with the check boxes. All code related to selection is placed into the GridCheckMarksSelection helper class, so it should be easy to port this functionality to your application.
Please note if you use the AppearanceEvenRow and AppearanceOddRow styles, by default they have a higher priority than the RowStyle event used for the selection in this example. To avoid drawing incorrect selected rows, enable the e.HighPriority option. See Also: E1271

Question Comments

Added By: Marco Villasesr at: 2/2/2014 8:31:14 AM    

Could you please attach a sample Project, please? thank you!!

Added By: david ola at: 12/17/2015 5:18:30 AM    

How do you respond to the selection change event? I needed to populate another grid based on the number of rows selected in my gridcontrol. Everything works well until no rows were selected. At that time, the SelectionChange event did not work. The other grid should be cleared when selectionCount become zero in my original gridcontrol, but it still displays the contents as if SelectionCount =1.
Is that a bug?

Added By: Nadezhda (DevExpress Support) at: 12/17/2015 12:43:08 PM    

Hello,

Before I suggest a solution, I need to know which approach you use. Do you utilize the GridCheckMarksSelection helper class or the CheckBoxRowSelect select mode?

I look forward to hearing from you.

Added By: Zvi Goldenberg at: 8/22/2016 3:51:22 AM    Hello. 
I need this functionality per column not per gridView.
Is it supported?
Thanks Added By: Dimitros (DevExpress Support) at: 8/22/2016 4:04:37 AM    

Hello,

I've created a separate ticket on your behalf (T417641: How to create multiple checkbox columns in GridView?). It has been placed in our processing queue and will be answered shortly.

Viewing all 7205 articles
Browse latest View live


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