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

OBSOLETE - ASPxGridView - How to implement navigation by Up/Left/Down/Right buttons when the Batch Edit mode is used

$
0
0
UPDATED:

Starting with version v2016 vol 1 (v16.1), this functionality is available out of the box. Set the grid's SettingsEditing.BatchEditSettings.StartEditAction property to the FocusedCellClick value to activate it. Please refer to the Batch Editing and Updating demo and ASPxGridView - Batch Edit - Provide cell focusing and keyboard navigation thread for more information.

If you have version v16.1+ available, consider using the built-in functionality instead of the approach detailed below.


For earlier versions:

In this example, ASPxGridView is used in Batch Edit mode. This feature allows users to move focus from one editable cell to another. Navigation is performed by the Up/Left/Down/Right buttons.

MVC:
GridView - How to implement navigation by Up/Left/Down/Right keyboard arrows in the Batch Edit mode
Question Comments

Added By: Corby Nichols at: 11/12/2015 6:18:46 AM    

Thank you very much, I will try your example over the weekend when I have more time to experiment.

For now I disabled the Mouse Wheel with AllMouseWheel = false and set the Increment to 0 and the Large Increment to 0 and it works.

Added By: Vova (DevExpress Support) at: 11/12/2015 6:42:04 AM    

You are welcome! If you have additional questions, feel free to create a separate ticket. We are here to address your inquiries.


OBSOLETE - GridView - How to implement navigation by Up/Left/Down/Right keyboard arrows in the Batch Edit mode

$
0
0

UPDATED:

Starting with version v2016 vol 1 (v16.1), this functionality is available out of the box. Set the grid's SettingsEditing.BatchEditSettings.StartEditAction property to the FocusedCellClick value to activate it. Please refer to the Batch Editing and Updating demo and ASPxGridView - Batch Edit - Provide cell focusing and keyboard navigation thread for more information.

If you have version v16.1+ available, consider using the built-in functionality instead of the approach detailed below.

For earlier versions:

This example illustrates how to implement custom keyboard navigation in Batch Edit mode.  
The main idea is to handle the keydown event for the grid's HTML table and manually switch the next cell to edit mode using  the ASPxClientGridViewBatchEditApi.StartEdit  method. 
The ASPxClientGridView.BatchEditStartEditing  event is used to remember the last editing row and column indices.

Note that keyboard navigation (via arrows) won’t work well for such editors as the ComboBox and SpinEdit because they have their own key event handlers, which will prevent custom logic from being executed. So, this approach is mainly for TextBox and Memo editors. However, it will be possible to use different keys in this scenario. 

This example doesn't implement data updates. Please refer to the GridView - A simple Batch Editing implementation example illustrating how to work with a model in Batch Edit mode.

Web Forms: 
ASPxGridView - How to implement navigation by Up/Left/Down/Right buttons when the Batch Edit mode is used

OBSOLETE - ASPxGridView - How to focus cells from top to bottom by Tab key pressing when the Batch Edit mode is used

$
0
0

UPDATED:

Starting with version v2016 vol 1 (v16.1), a similar functionality is available out of the box. Set the grid's SettingsEditing.BatchEditSettings.StartEditAction property to the FocusedCellClick value to activate it. Please refer to the Batch Editing and Updating demo and ASPxGridView - Batch Edit - Provide cell focusing and keyboard navigation thread for more information.

If you have version v16.1+ available, consider using the built-in functionality instead of the approach detailed below.

For earlier versions: 

This example demonstrates how to change the order of focusing ASPxGridView cells by pressing the Tab key when the Batch Edit mode is used.

In this example, the ASPxClientUtils.AttachEventToElement method allows defining a handler for the keydown event of ASPxGridView's main element. The ASPxClientGridViewBatchEditApi.StartEdit method is used for changing the order of cell focusing. A list of read-only column indexes is stored in ASPxGridView.JSProperties.

ASPxDashboardDesigner - How to save dashboards to a data base

$
0
0
This example shows how to create a custom dashboard storage that allows storing dashboards in a data base.
Custom dashboard storage should implement the IDashboardStorage interface, that contains the following public methods:

string CreateNewDashboard() - creates a new dashboard and saves it to a storage. Returns an ID of the created dashboard.
XDocument GetDashboard(string id) - returns a dashboard by its id in the  XDocument format that describes an object model of the dashboard. 
IEnumerable<string> GetDashboardIDs() - returns a list of IDs of dashboards available in the data storage .
void UpdateDashboard(string id, XDocument document) - updates the dashboard by its id with new settings.
Question Comments

Added By: David Ösztreicher at: 5/26/2016 10:15:07 AM    I'm trying to apply this to the recent 16.1.2 release but it seems that the IDashboardStorage signatures have changed.
Can you provide a link to updated documentation or code examples?

How to import a large data set using XPO efficiently within a transaction

$
0
0
When you are required to import a large data set into a database as XPO persistent objects, the straightforward approach might be inappropriate. Specifically, if you would create objects objects one by one and commit them individually, you cannot roll back changes if one object failed to commit. If you use an XPO transaction or unit of work, changes can be rolled back, but it will require a lot of memory to keep all objects until the final commit.

The solution demonstrated in this example commits objects in small batches by creating a unit of work for each batch and disposing of it after it is committed. To be able to roll back all batches at once, it utilizes the database-level transaction using the XPO data layer's command channel. Although XPO provides a public API for using database transactions (Using Explicit Transactions), it cannot be used in this scenario because explicit transactions belong to sessions, but here we use separate sessions for each batch.

Below is a managed memory allocation chart produced by this example if you log GC.GetTotalMemory(true) values in the CreatePersistentObject method:


Question Comments

Added By: Casey Chester 2 at: 1/14/2016 7:30:31 AM    

Nice!

Added By: Saif Khan at: 5/30/2016 3:40:56 AM    How can this be achieved with nested UOWs? Example a parent record (Invoice) with one row and a child (InvoiceDetails) with 4k rows - I have a similar situation and borrowing from the sample below, my result is taking a long time to insert the details to the DB while plain old ADO.NET is much faster.

It was suggested that I also "recreate the parent Unit of Work after committing changes to reset its cache...", but I don't see how that's possible when i am using the parent object to pass to the child in order to create the relationship.

WPF End-User Report Designer - How to Implement a Report Storage

$
0
0

This example demonstrates how to implement report storage to persist report definitions in a database or in any other custom location. This enables your end-users to create and customize reports using the End-User Designer for WPF and have a common target for saving and sharing all reports. This functionality is accomplished through the DevExpress.Xpf.Reports.UserDesigner.IReportStorage interface. The interface provides the following methods:

• bool CanCreateNew();

Indicates whether or not it is possible to create a new tab with a blank report in the designer.

• bool CanOpen();

Indicates where or not the "Open" command is available.

• XtraReport CreateNew();

Provides the capability to customize a new report template.

• XtraReport CreateNewSubreport();

Provides the capability to customize a new subreport report template (i.e., a new report opened by double-clicking a specific XRSubreport control).

• string GetErrorMessage(Exception exception);

Provides the capability to display an error message for any encountered exception (a general one or the exception message if you expect that the user can understand and react based on this information).

• string Open(IReportDesignerUI designer);

This method expects a unique ID of the report selected by an end-user via a custom dialog.

• XtraReport Load(string reportID, IReportSerializer designerReportSerializer);

This method passes the report ID that has been selected at the previous step and expects the actual report instance to be loaded and returned. You may or may not use the IReportSerializer functionality to save or load a given report from a stream.

• string Save(string reportID, IReportProvider reportProvider, bool saveAs, string reportTitle, IReportDesignerUI designer);

This method is intended to save the currently edited reports. The method's parameters are:

- reportID is a unique ID of the edited report (null if it is a new report with no ID specified);

- reportProvider allows you to access the actual report instance being edited and optionally rename it (a new name will be updated in the designer as well);

- saveAs indicates which particular command has been executed ("Save" or "Save As").

- reportTitle represents the actual report title (the XtraReport.DisplayName property value).

- designer is the actual report designer instance (a DevExpress.Xpf.Reports.UserDesigner.ReportDesigner object).

 

See also: Report Storage for the WinForms End-User Report Designer.

MVCxWebDocumentViewer: How to use WebDocumentViewer within a DevExtreme application

$
0
0

This example illustrates a DevExtreme-based client application that uses a Web Document Viewer control.

The example includes the following two applications.

- Frontend that is a pure HTML5 client, to which appropriate scripts and styles are assigned (along with HTML templates required by the Document Viewer).

- Backend that is an MVC 4 application in two implementations: with a Web API Controller and MVC Controller. At the backend, cross-domain requests are enabled (Access-Control-Allow-Origin) and a custom report resolver is implemented (CustomReportResolver).

How to make the auto filter row's filter accent insensitive

$
0
0

This example demonstrates how to create a custom function that removes all diacritic symbols from the specified string value. Using the GridView.SubstituteFilter event, this function can be injected into the active grid filter.

The SubstituteFilter event was added in version 2015 vol 1. To accomplish this task in older version, create a custom grid and customize the mechanism of filtering data via the auto filter row. For this, the GridView.RaiseCustomRowFilter method can be overridden. In this method, the cell text and filter string should be normalized via the standard String.Normalize method and then the cell value is processed based on the comparison operator type returned via the OptionsColumnFilter.AutoFilterCondition property.


How to print multiple reports as a single batch

$
0
0

The following example demonstrates how to print several reports in a single batch, instead of sending one report at a time to the printer. Also, in this example, the Print dialog is invoked for the first report only, and the other reports are printed without any dialogs, but using the same print settings.

To print a report, use the PrintTool (the PrintTool.PrintDialog and PrintToolBase.Print methods). You'll also need to handle XtraReport's PrintingSystemBase.StartPrint event.

See Also:
- How to programmatically select a printer;
- How to hide the Printing status window;
- How to determine the settings of the selected printer when the OK button is pressed in the Printer dialog;
- How to dynamically select the paper source and set the printer resolution;
- How to programmatically print a specified range of report pages.

Question Comments

Added By: Andrej Bukin at: 12/15/2015 11:09:05 PM    

all 4 links on documentation are broken

Added By: Jannet (DevExpress Support) at: 12/16/2015 12:20:10 AM    Hello Andrej,
We greatly appreciate you pointing this out. I've corrected these links. Please check them out.Added By: dsk96m at: 5/31/2016 12:37:07 PM    This is not correct.  You have pt1.printdialog, but if a user clicks cancel, it still got on to the next step and loops through the reports and prints them.  How do you test if the user clicked cancel in the print dialog window.

OBSOLETE - How to set the size of the popup window shown via the PopupWindowShowAction in WinForms

$
0
0

==========================================
This example is now obsolete. Instead, refer to the How to: Adjust the size of pop up dialogs  example.
==========================================
To accomplish this you can handle the CustomizeTemplate event of the PopupWindowShowAction or XafApplication classes and access the actual template to set its size as needed.

See Also:
How to Show a Window via an Action

Question Comments

Added By: Mario Blatarić at: 7/30/2013 5:08:24 AM    

Could you create Web example as well?
It seems this is not as straightforward for Web.

Added By: Dennis (DevExpress Support) at: 7/31/2013 2:38:35 AM    

Thanks for the feedback, we will consider updating this example to include a solution from the http://documentation.devexpress.com/#Xaf/CustomDocument3456 help article.

Added By: Hitha at: 6/24/2014 3:31:43 AM    

Hi,
  I have set the size as per your code but that is not the size I see when the pop window is shown.
((PopupForm)e.Template).Size = new System.Drawing.Size(400, 130);
Added to that if I have enabled IsSizeable then the window size is properly set(but not set to 400,130) without empty space and if IsSizeable is disabled then it is set to some random value with empty space below/above.

Please suggest a way around this. thanks

Added By: Dennis (DevExpress Support) at: 6/24/2014 7:03:06 AM    @Hitha: I suggest you additionally handle the HandleCreated event as demonstrated in the How to define the size of a popup ticket. I hope this helps.Added By: Alexandre Miller at: 5/31/2016 2:25:16 PM    Why is this article obsolete, but points to an ASP solution? The title says it's for WinForm.

How to obtain a dashboard item's underlying data in the Web Viewer

$
0
0

The following example demonstrates how to get underlying data corresponding to a particular visual element using the ASPxClientDashboardViewer's API.

In this example, the ASPxClientDashboardViewer.ItemClick event is handled to obtain underlying data and invoke the dxPopup widget with the child dxDataGrid.

In the event handler, the RequestUnderlyingData method is called to obtain records from the dashboard's data source. The dxDataGrid is used to display these records.

Question Comments

Added By: Angelo G at: 5/31/2016 9:18:34 AM    Hello,

I would like to show dashboard item's underlying data using mouse right click event or double click, instead of left click event. Please let me know how to do it.

Thanks. Added By: John (DevExpress Support) at: 5/31/2016 10:50:59 PM    Hello Angelo,
You have already asked this question in a separate topic: How to obtain a dashboard item's underlying data in the Web Viewer using double click event or right click event. Refer to it for further correspondence. 

ASPxGridView - How to make some field editors read-only when editing a row and allow their editing when adding a new row

$
0
0

This example demonstrates how to set the editor's ReadOnly property based on the grid's state. I.e. it is possible can edit field value while adding a new row, but this editor becomes ReadOnly if we trying to edit existing row.


It is used the ASPxGridView.CellEditorInitialize event to implement this scenario:

[C#]
protectedvoidgridView_CellEditorInitialize(objectsender,DevExpress.Web.ASPxGridView.ASPxGridViewEditorEventArgse){ASPxGridViewgrid=senderasASPxGridView;if(e.Column.FieldName=="CategoryID")e.Editor.ReadOnly=!grid.IsNewRowEditing;}

Question Comments

Added By: Ju Yeong Jeong at: 1/15/2015 1:00:32 AM    

It's so good example.

Thank you so much !!!

[ASPX]

<dx:ASPxGridView ID="grid" ClientInstanceName="grid" ....
KeyFieldName="MST_CD" OnCellEditorInitialize="grid_CellEditorInitialize">

<dx:ASPxGridView ID="gridDetail" ClientInstanceName="gridDetail" ....
KeyFieldName="MST_CD;CD" OnCellEditorInitialize="grid_CellEditorInitialize">

[C#]
   protected DataTable dtGrid = null;
   protected DataTable dtGridDetail = null;

   protected void Page_Load(object sender, EventArgs e)
   {
       if (! Page.IsPostBack)
       {
               //GET DATATABLE
               dtGrid = dataset.Tables[0];
               //SET PRIMARY KEY(S)
               dtGrid.PrimaryKey = new DataColumn[] { dtGrid.Columns["MST_CD"] };
               //SET SESSION
               Session["DataSet"] = dtGrid;

               dtGridDetail = dataset2.Tables[0];
               dtGridDetail .PrimaryKey = new DataColumn[] { dtGrid.Columns["MST_CD;CD"] };
               Session["DataSetDetail"] = dtGridDetail ;
       }
       else
       {
           dtGrid = (DataTable)Session["DataSet"];
           dtGridDetail = (DataTable)Session["DataSetDetail"];
       }

       grid.DataSource = dtGrid;
       grid.DataBind();

       gridDetail.DataSource = dtGridDetail;
       gridDetail.DataBind();
   }

   /// <summary>
   /// Prevent Editing of the Key Column(s) on Cell Updating
   /// </summary>
   /// <param name="sender"></param>
   /// <param name="e"></param>
   protected void grid_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e)
   {
       ASPxGridView oGrid = sender as ASPxGridView;

       string sSession = string.Empty;

       if ("grid" == oGrid.ClientInstanceName )
       {
           sSession = "DataSet";
       }
       else if ("gridDetail" == oGrid.ClientInstanceName)
       {
           sSession = "DataSetDetail";
       }

       DataTable oDt = (DataTable)Session[sSession];
       
       for (int i = 0; i < oDt.PrimaryKey.Length; i++)
       {
           if (e.Column.FieldName == oDt.PrimaryKey[i].ColumnName)
           {
               e.Editor.ReadOnly = !oGrid.IsNewRowEditing;
               return;
           }
       }
   }

Added By: Quasar Wong at: 5/3/2015 9:00:10 PM    

Hi! I am using Batch Edit mode but CellEditorInitialize event will not fired when clicking New button, any other method can do this scenario else? Thanks!

Added By: Larry (DevExpress Support) at: 5/3/2015 10:55:45 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T237217: ASPxGridView - Batch Editing - The CellEditorInitialize event will not fired when clicking New button. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Ravi Anand 1 at: 6/1/2016 12:34:16 AM    Hi, i have applied given example in ASP.NET MVC, folllwing is my gridview settings sample partial code:

[C#]
settings.CellEditorInitialize=(s,e)=>{ASPxGridViewgrid=sasASPxGridView;ASPxEditeditor=(ASPxEdit)e.Editor;if(e.Column.FieldName=="columnName1"||e.Column.FieldName=="columnName2"){e.Editor.ReadOnly=!grid.IsNewRowEditing;}};

now i can't edit while updating existing row data, that seems perfect.

but i can't edit both columns while creating new row using new button. please help me out here. Thank you in advance.

How to dynamically send a report via e-mail as a PDF

$
0
0

This example illustrates how to automatically send a report via e-mail. To do this, a report should first be exported into one of the available formats. In this example, a report is exported to PDF, since this format provides the best output quality (the PDF result is as close to a report's print result as possible).

See also:
How to send a report as HTML in an email body

Question Comments

Added By: MohammedFarooq at: 10/20/2015 1:11:44 PM    

Hi,
I am getting the following error when the button is clicked. For your information, i am executing this logic in XAF viewcontroller SimpleAction button execute event

Error sending a report.
System.Exception: Null object cannot be converted to a value type. ---> System.Exception: Null object cannot be converted to a value type. ---> System.InvalidCastException: Null object cannot be converted to a value type.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType)
at DevExpress.XtraReports.UI.XRSubreport.ApplyParameterBindings()
at DevExpress.XtraReports.UI.XRSubreport.OnBeforePrint(PrintEventArgs e)
at DevExpress.XtraReports.UI.XRControl.GetPrintableBrick(XRWriteInfo writeInfo)
at DevExpress.XtraReports.UI.XRControl.WriteContentTo(XRWriteInfo writeInfo)
at DevExpress.XtraReports.UI.Band.GenerateContent(DocumentBand docBand, Int32 rowIndex, Boolean fireBeforePrint)
at DevExpress.XtraReports.UI.Band.GenerateContentAndDecompose(DocumentBand docBand, Int32 rowIndex, Boolean fireBeforePrint)
at DevExpress.XtraReports.UI.Band.CreateDocumentBand(Int32 rowIndex, RootDocumentBand rootDocBand, PageBuildInfo pageBuildInfo)
at DevExpress.XtraReports.UI.DetailBand.CreateDocumentBand(Int32 rowIndex, Int32 rowCount, RootDocumentBand rootDocBand, PageBuildInfo pageBuildInfo)
at DevExpress.XtraReports.Native.Printing.DetailWriterBase.WriteDetailCore(PageBuildInfo pageBuildInfo)
at DevExpress.XtraReports.Native.Printing.DetailWriterBase.Write(DocumentBand rootBand, PageBuildInfo pageBuildInfo)
at DevExpress.XtraReports.Native.Printing.DocumentBuilder.GetBand(DocumentBand rootBand, PageBuildInfo pageBuildInfo)
at DevExpress.XtraPrinting.Native.DocumentBand.GetBand(PageBuildInfo pageBuildInfo)
at DevExpress.XtraPrinting.Native.PageHeaderFooterRowBuilderBase.CanProcessDetail(DocumentBand rootBand, PageBuildInfo pageBuildInfo)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBands(DocumentBand rootBand, RectangleF bounds, ProcessBandsDelegate process)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillReportDetails(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageHeaderFooterRowBuilderBase.FillReportDetailsAndFooter(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPage(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageRecursive(DocumentBand rootBand, DocumentBand docBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageHeaderFooterRowBuilderBase.FillPageRecursive(DocumentBand rootBand, DocumentBand docBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBandCore(DocumentBand rootBand, RectangleF bounds, RectangleF newBounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBand(DocumentBand rootBand, RectangleF bounds, RectangleF newBounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBands(DocumentBand rootBand, RectangleF bounds, ProcessBandsDelegate process)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillReportDetails(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageHeaderFooterRowBuilderBase.FillReportDetailsAndFooter(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPage(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageRecursive(DocumentBand rootBand, DocumentBand docBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageHeaderFooterRowBuilderBase.FillPageRecursive(DocumentBand rootBand, DocumentBand docBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBandCore(DocumentBand rootBand, RectangleF bounds, RectangleF newBounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBand(DocumentBand rootBand, RectangleF bounds, RectangleF newBounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBands(DocumentBand rootBand, RectangleF bounds, ProcessBandsDelegate process)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillReportDetails(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageHeaderFooterRowBuilderBase.FillReportDetailsAndFooter(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPage(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageRecursive(DocumentBand rootBand, DocumentBand docBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageHeaderFooterRowBuilderBase.FillPageRecursive(DocumentBand rootBand, DocumentBand docBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBandCore(DocumentBand rootBand, RectangleF bounds, RectangleF newBounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBand(DocumentBand rootBand, RectangleF bounds, RectangleF newBounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBands(DocumentBand rootBand, RectangleF bounds, ProcessBandsDelegate process)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillReportDetails(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageHeaderFooterRowBuilderBase.FillReportDetailsAndFooter(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPage(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageRecursive(DocumentBand rootBand, DocumentBand docBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageHeaderFooterRowBuilderBase.FillPageRecursive(DocumentBand rootBand, DocumentBand docBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBandCore(DocumentBand rootBand, RectangleF bounds, RectangleF newBounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBand(DocumentBand rootBand, RectangleF bounds, RectangleF newBounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPageForBands(DocumentBand rootBand, RectangleF bounds, ProcessBandsDelegate process)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillReportDetails(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageHeaderFooterRowBuilderBase.FillReportDetailsAndFooter(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageRowBuilderBase.FillPage(DocumentBand rootBand, RectangleF bounds)
at DevExpress.XtraPrinting.Native.PageBuildEngine.Build()
at DevExpress.XtraPrinting.Native.PageBuildEngine.BuildPages(DocumentBand rootBand, Boolean clearGroupingInfo)
--- End of inner exception stack trace ---
at DevExpress.XtraPrinting.PrintingSystemBase.OnCreateDocumentException(ExceptionEventArgs args)
at DevExpress.XtraPrinting.Native.PageBuildEngine.RaiseCreateDocumentException(Exception exception)
at DevExpress.XtraPrinting.Native.PageBuildEngine.BuildPages(DocumentBand rootBand, Boolean clearGroupingInfo)
at DevExpress.XtraPrinting.Native.DocumentHelper.BuildPagesCore()
at DevExpress.XtraPrinting.Native.DocumentHelper.BuildPages()
at DevExpress.XtraPrinting.Native.PrintingDocument.BuildPages()
at DevExpress.XtraPrinting.Native.PrintingDocument.End(Boolean buildPagesInBackground)
at DevExpress.XtraPrinting.PrintingSystemBase.End(Boolean buildPagesInBackground)
at DevExpress.XtraReports.UI.XtraReport.CreateDocumentCore(PrintingSystemBase ps, Single progressRange, Boolean buildPagesInBackground)
at DevExpress.XtraReports.UI.XtraReport.CreateDocument(Single progressRange, Boolean buildPagesInBackground, Boolean suppressClearDataContext)
at DevExpress.XtraReports.UI.XtraReport.TryCreateDocument(Single progressRange, Boolean buildPagesInBackground, Boolean suppressClearDataContext)
--- End of inner exception stack trace ---
at DevExpress.XtraPrinting.PrintingSystemBase.OnCreateDocumentException(ExceptionEventArgs args)
at DevExpress.XtraReports.UI.XtraReport.TryCreateDocument(Single progressRange, Boolean buildPagesInBackground, Boolean suppressClearDataContext)
at DevExpress.XtraReports.UI.XtraReport.CreateIfEmpty(Single progressRange, Boolean buildPagesInBackground)
at DevExpress.XtraReports.UI.XtraReport.ExportToPdf(Stream stream, PdfExportOptions options)
at DevExpress.XtraReports.UI.XtraReport.ExportToPdf(Stream stream)
at Solution6.Module.vcPayroll.SimpleAction1_Execute(Object sender, SimpleActionExecuteEventArgs e) in E:\My Docs\Projects\Solution6\Code\Solution6.Module\BusinessObjects\10 Payroll\Payroll Run\vcPayroll.vb:line 179

Added By: MohammedFarooq at: 10/20/2015 1:12:27 PM    

The error happens at this line

report.ExportToPdf(mem)

Added By: Ingvar (DevExpress Support) at: 10/21/2015 1:28:10 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T302655: NullReferenceException when trying to apply solution described in E16. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to implement a master-detail report using Subreports (XRSubreport) without parameter bindings

$
0
0
This example demonstrates how to implement a master-detail report using Subreports without parameter bindings but through the BeforePrint event of the XRSubreport.
Please refer to the How to implement a master-detail report using Subreports (XRSubreport) without parameter bindings KB article for implementation details.

NOTE: The subreport parameter bindings feature introduced in version 15.1 enables you to implement this without writing any code. For more information, see How to: Create a Master-Detail Report using Subreports.
Question Comments

Added By: Eric Feuillard at: 6/1/2016 7:06:18 AM    Thank you,

I try
Added By: Jannet (DevExpress Support) at: 6/1/2016 7:11:10 AM    Feel free to contact us if you have any questions, Eric.

How to display the dxChart widget in an XAF view

$
0
0

Scenario:
It is necessary to show a chart control with a lot of points. The built-in Charts module draws all points on the same screen at once, which may be inconvenient for an end-user. To achieve better usability, it is possible to implement real-time zooming and scrolling capabilities.

The dxChart widget from the DevExtreme library perfectly fits this scenario. This example demonstrates how to utilize this widget in an XAF application.



Steps to implement:
The approach used in this example is based on the well-known technique of displaying a custom data bound control described in our online documentation: How to: Show a Custom Data-Bound Control in an XAF View (ASP.NET). The example demonstrates how to use this technique with client-side components that do not have server-side implementation. Refer to the following Knowledge Base article for more details and concepts: How to use DevExtreme Widgets in an XAF application.


1. Register client libraries.
Since you need to control the order of referenced client libraries, it is necessary to disable automatic embedding of them using the dedicated option in the application configuration file. This option and the list of client libraries required by our ASP.NET controls are described in our online documentation: Embedding Required Client Libraries.
Disable the embedRequiredClientLibraries option in the YourSolutionName.Web/Web.config file and add required client libraries to the YourSolutionName.Web project using the following commands in the NuGet Package Manager console:
    Install-Package Microsoft.jQuery.Unobtrusive.Ajax
    Install-Package jQuery.Validation.Unobtrusive
    Install-Package ChartJS
Library files will be installed into the Scripts and Content directories. Register the required script files in the <head> element of the YourSolutionName.Web/Default.aspx file.

[HTML]
<linkrel="stylesheet"type="text/css"href="Content/dx.common.css"/><linkrel="stylesheet"type="text/css"href="Content/dx.light.css"/><scripttype="text/javascript"src="Scripts/jquery-1.11.3.min.js"></script><scripttype="text/javascript"src="Scripts/jquery.validate.min.js"></script><scripttype="text/javascript"src="Scripts/jquery.validate.unobtrusive.min.js"></script><scripttype="text/javascript"src="Scripts/jquery.unobtrusive-ajax.min.js"></script><scripttype="text/javascript"src="Scripts/globalize/globalize.js"></script><scripttype="text/javascript"src="Scripts/dx.webappjs.js"></script><scripttype="text/javascript"src="Scripts/dx.chartjs.js"></script>


2. Create content.
In the YourSolutionName.Web project, create a custom ASP.NET User Control (*.ascx) and add ASPxPanel to it. This panel will be a container for DevExtreme widgets. It is convenient to keep client-side scripts in a separate file. Add a JavaScript file and declare the createWidgets function in it. Implement this function using the approach described in the Zooming and Scrolling article.

[JScript]
window.DxSample = window.DxSample || {}; window.DxSample.OrdersChart = { createWidgets: function(panel){var $mainElement = $(panel.GetMainElement()); $mainElement.dxChart({..});}};

Using the client-side Init event of the ASPxPanel component, call the createWidgets function passing the first event argument as a parameter.

3. Register your JavaScript files.
In code behind for your UserControl (e.g., YourSolutionName.Web/YourUserControlName.ascx.xx file), handle the UserControl.Load event and call the WebWindow.RegisterClientScriptInclude method to include your JavaScript file into the web page.

4. Load data and pass it to the client side.
To provide data for client-side widgets, use the approach described in the following article: How to: Access Server Data on the Client Side. For this purpose, implement the IComplexControl interface in your UserControl class. Within the IComplexControl.Setup method, load data from the database, convert it into an array of plain objects (you can use anonymous types in C# and VB.NET for this purpose), and add it to the JSProperties dictionary.


GridListEditor - How to add a custom unbound column to the GridView in ListView to execute a custom business action for a record

$
0
0

This example shows how to add a custom unbound column to the GridControl in ListView. In the example, a button will be shown in this custom column. When a button is clicked, a custom business action will be executed on the selected record. To be more precise, the boolean Active property of the Order business class will be reversed.
To accomplish this task, we will declare a public SimpleBusinessAction method within the Order class. This will allow to reverse the Active property because for demo purposes it won't have a public setter allowing to set this property directly.
To add a custom unbound column to the GridControl, we will create a new column and configure its editor as needed. To learn more about the GridControl's customizations please refer to the XtraGrid's documentation.

Take special note that XAF Web applications support this scenario out-of-the-box. You can make a method within your business class and mark it with the ActionAttribute. Then, XAF will produce an Action column in the List View for your business class. Refer to the documentation for more details.

IMPORTANT NOTES
One of the prerequisites for this particular solution and the DataAccessMode = Server mode is to have a valid IModelMember defined in the Application Model. You can do this via the Model Editor as described in the eXpressApp Framework > Concepts > Business Model Design > Types Info Subsystem > Customize Business Object's Metadata article.

See Also:
How to provide an inline Action shown right within the ListView control row on the Web
Access Grid Control Properties
Assigning Editors to Individual Cells
Repositories and Repository Items
ActionAttribute Class

Question Comments

Added By: Salam at: 11/27/2012 10:31:29 PM    

Hello Devexpress,
                How to apply the same in Web application?

Added By: Apostolis Bekiaris (DevExpress) at: 1/4/2013 4:00:06 PM    

See also this post http://community.devexpress.com/blogs/eaf/archive/2011/09/16/expandframework-supporting-unbound-columns.aspx

How to send a report as HTML in an email body

$
0
0

This example demonstrates how to export a report to an email message and use the mailing functionality of the .NET Framework to programmatically send the generated message to an arbitrary number of recipients using the required email settings. To accomplish this task, use the report's ExportToMail method. This method returns an instance of the System.Net.Mail.MailMessage class. The body of the resulting mail message contains an HTML representation of the report contents optimized for sending using email.

After a mail message is generated, you can initialize a System.Net.Mail.SmtpClient and call its SmtpClient.Send method to send the message.

How to combine links via the CompositeLink

ASPxGridView - Shopping Cart example (POS Interface)

$
0
0
This example illustrates how to implement a Shopping Cart functionality based on the ASPxGridView control.

How to show a specific View for some users

$
0
0

Scenario:

This example demonstrates how to show a custom View against a role of the currently logged user. Custom Views were created and customized through the Model Editor for each role separately. For more convenience, custom Views have a name of a role in the Id attribute. For instance: Contact_ListView_Administrators, Contact_DetailView_Administrators, Contact_ListView_Users, Contact_DetailView_Users, etc. You may consider a specific naming convention, for example, to add a role name to the end of the view name.


Implementation details:

1) There is CustomizeViewAgainstRoleMainWindowController that tracks View showing using the XafApplication.ViewCreating event and replaces the default View's Id with a custom Id found in the Application model by the role name. 

1 alt)Alternatively, you can handle the XafApplication.UserDifferencesLoaded event and patch the ViewID of required navigation items under the NavigationItems node as well as the DefaultListView/DefaultDetailView attributes of the BOModel | Class nodes.

Question Comments

Added By: Serkan Dede 1 at: 1/14/2016 10:27:35 AM    

Hi,

I got error in Application_ViewShowing method on line :
e.View.SetModel(modelView);

Error Message:
Cannot change property 'DefaultSorting' when the XPCollection is not in design or initialization mode.

Any idea to resolve this issue?

Added By: Dennis (DevExpress Support) at: 1/15/2016 2:02:00 AM    

Hello Serkan,

To process your recent post more efficiently, I created a separate ticket on your behalf: T334575: The "Cannot change property 'DefaultSorting' when the XPCollection is not in design or initialization mode" error occurs when calling e.View.SetModel(modelView);. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Joel Sanches at: 4/20/2016 11:27:52 AM    This is marked as obsolete. What would be the present recommendation to handle the same scenario in XAF?Added By: Alexey (DevExpress Support) at: 4/21/2016 9:25:16 AM    

Hello Joel ,
I've created a separate ticket on your behalf (T370594: E274 in 15.2). 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>