This example demonstrates how to create a custom popup edit form for a data grid. In this example, I used the Popup widget and the ContentTemplate field for that. To create edit buttons, you can use the CellTemplate field.
MVC - how to create a custom popup edit form
How to group data at runtime
This example demonstrates how to group a report's data in code, in particular, group products by categories.
In this sample, the report is bound to the Northwind database's CategoryProducts view. The report contains the DetailBand and GroupHeaderBand, and its data is grouped by the CategoryName data field.
See also:
- How to count the number of groups in a report;
- How to group (sort) a report by days of week;
- How to implement custom grouping (group by Year and Month);
- How to insert page numbers for groups.
How to create a custom template for the Excel column filter drop-down window
This example illustrates how to create a custom template for the Excel column filter drop-down window.
In particular, this sample shows how to filter string data by their length. For this, we created a special template containing an additional editor allowing you to enter the required length. For simplicity, we additionally filter a set of the current filter values shown in a list box based on a value of this editor. This template is assigned to the necessary column filter drop-down window by using the FilterPopupExcelPrepareTemplate event. Next, we handle the FilterPopupExcelCustomizeTemplate event to populate our template controls with the necessary filter values.
How to handle DiagramControl events to save diagrams to a database instead of a file system
ShowingOpenDialog - This event fires before the standard Open dialog is shown and allows you to customize the dialog options or replace the standard dialog with a custom one. You can also cancel the Open operation by setting the e.Cancel parameter to true.
ShowingSaveDialog - Similarly to the ShowingOpenDialog event, the ShowingSaveDialog event allows you to customize the standard Save dialog in DiagramControl or replace it with a custom one. Setting the e.Cancel parameter to true will cancel the Save operation.
CustomLoadDocument - This event fires after a user selected a document in the Open dialog or the DocumentSource property was set in code. The event exposes the selected document source (e.g., a document name or a file stream) through the e.DocumentSource property and allows you to implement your own loading logic. For example, you can retrieve a diagram file from a database and load it into DiagramControl using the LoadDocument property (as demonstrated in the example) or populate the diagram with items manually. After implementing your custom loading logic, set the e.Handled parameter to true, so that DiagramControl does not load the previously selected document source.
CustomSaveDocument - The CustomSaveDocument event allows you to specify custom saving logic for your diagram. The event fires after the Save operation was initiated and selection was made in the Save dialog (if there was a dialog). The e.DocumentSource property in the event args specifies the default location (file name, stream, etc.) where the diagram will be saved. You can set the e.Handled parameter to true to cancel the standard saving logic and implement your custom one. For example, save the diagram to a stream using the SaveDocument method as demonstrated in the example or iterate through diagram items manually and read required information.
Question Comments
Added By: Adil Abdullah Bangush at: 12/31/2017 9:38:33 PM Dear Sir
Please tell us, how to demonstrate the same shape items with XPO Objects and XPCollection.
With Regard
ADIL ABDULLAH
How to implement the ItemsSource property for the LayoutControl control
LayoutControl doesn't have the ItemsSource property. To generate items from a collection, attached behavior was created. This behavior generates LayoutItems and adds them to the Children collection.
Question Comments
Added By: Andrew Cope 2 at: 1/2/2018 3:46:31 AM I had to override the OnAttached() event:
And you also need a guard on ArrangeChildren():[C#]protectedoverridevoidOnAttached(){base.OnAttached();ArrangeChildren();}
[C#]{if(AssociatedObject==null)return;
Without this ArrangeChildren() was only called once and it was before AssociatedObject had been set.
Although so far it hasn't actually solved my problem anyway - the controls haven't lined up :-/
How to suppress the save confirmation dialog when closing a DetailView for a new object left untouched by an end-user
Scenario
This example demonstrates how to implement the following behavior (which is default in Microsoft Outlook) in XAF Windows Forms applications:
- A user can create a new record, and when its detail form is opened he or she may close the form without entering any data (e.g., a new record was created by accident). In this case, the form can be closed without any save confirmation, because no user data needs to be saved.
- If a user enters some data into the form and then closes it, the save confirmation appears as expected not to lose entered data.
To implement it
Copy the WinSolution.Module.Win\SuppressConfirmationForNewObjectsDetailViewController.xx file into YourSolutionName.Module.Win project.
To test it
You can also run functional tests from the E2114.EasyTests\E2114.ets folder.
See Also:
WinModificationsController Class
ModificationsController.ModificationsHandlingMode
Core - Disable the confirmation dialog when closing a form with a new object left untouched
Question Comments
Added By: rushdan . at: 12/4/2014 2:08:46 AM
I have see example . That is great.
So I would like to ask, is it possible to apply for Web ?
Thanks
Added By: Dennis (DevExpress Support) at: 12/4/2014 2:40:43 AM @rushdan: This solution cannot be applied to the Web version because there are no such confirmation dialogs there by default.Added By: Paul Kubb at: 3/31/2016 9:04:33 PM Just a little comment that I think this feature should be out-of-the-box.Popping out this message every time even nothing touched is annoying and I don't think anybody will like it.Added By: Dennis (DevExpress Support) at: 4/1/2016 2:19:57 AM @Paul: Our team will take your feedback into account, thanks.Added By: Alex Miller at: 4/1/2016 4:22:05 AM I totally agree with Paul.
@Dennis Please +1 :) Added By: Dennis (DevExpress Support) at: 4/1/2016 6:10:00 AM OK, thanksAdded By: Willem de Vries at: 1/4/2018 1:05:00 AM What if this was default behavior?
GridView - How to display a hyperlink in templated column
[C#]settings.Columns.Add(column=>{column.Caption="Details";column.SetDataItemTemplateContent(container=>{Html.DevExpress().HyperLink(hyperlink=>{varvisibleIndex=container.VisibleIndex;varkeyValue=container.KeyValue;varlastName=DataBinder.Eval(container.DataItem,"LastName");hyperlink.Name="hl"+keyValue.ToString();hyperlink.Properties.Text=lastName.ToString();hyperlink.NavigateUrl=Url.Action("Details","Home",new{id=keyValue});}).Render();});});
[VB.NET]settings.Columns.Add( _Sub(column) column.Caption = "Details" column.SetDataItemTemplateContent( _Sub(container) Html.DevExpress().HyperLink( _Sub(hl)Dim visibleIndex = container.VisibleIndexDim keyValue = container.KeyValueDim lastName = DataBinder.Eval(container.DataItem, "LastName") hl.Name = "hl" + keyValue.ToString() hl.Properties.Text = lastName.ToString() hl.NavigateUrl = Url.Action("Details", "Home", NewWith {.id = keyValue})EndSub).Render()EndSub)EndSub)
Question Comments
Added By: Ross Edwards at: 1/4/2018 2:40:53 AM Is there a way to do this with columns that are auto created such as in my own example?
[C#]MvcHtmlStringgrid=Html.DevExpress().GridView(settings=>{settings.Name="GridView";settings.CallbackRouteValues=new{Controller="Vehicles",Action="GridViewPartial2",model=Model};settings.DataBound=(sender,e)=>{varg=senderasMVCxGridView;g.Columns["id"].Visible=!(g.Columns.Count> 0);//I'd like this to be clickable rather than hidden}};}).Bind(Model.VehicleHistory).GetHtml();
Added By: Lex (DevExpress Support) at: 1/4/2018 3:02:34 AM
Hello Ross,
I've created a separate ticket on your behalf (T592696: GridView - How to display a hyperlink in a templated column when columns are autogenerated). It has been placed in our processing queue and will be answered shortly.
DataGrid - How to reorder rows using drag-and-drop
To accomplish this task, we need to perform the following steps:
1. Set a fake CSS class ("myRow") to a data row. This will help us find all data rows using a jQuery selector and assign Draggable and Droppable plug-ins to the rows. Assign the key value of each row to a row element. We need to use the dxDataGrid.rowPrepared callback function for this step.
2. When the drop event fires, we need to get indexes of the dropped and the target rows, recalculate indexes according our requirements and save them to a data store.
3. Reload data by calling the dxDataGrid.refresh method.
See also:
ArrayStore.load
ArrayStore.byKey
ArrayStore.update
.data()
Question Comments
Added By: Frederico Lima at: 6/24/2016 3:56:10 PM Update this tutorial. It does not work for the most current version. Added By: Gosha (DevExpress Support) at: 6/27/2016 6:17:42 AM
Hi Frederico,
Thank you for bringing this issue to our attention. I've uploaded the updated version of this example that uses our 16.1 version.
You are welcome!
How to export GridView data to different text formats
This example is standalone implementation of the online Grid View - Exporting Data demo.
It illustrates how to export the GridView 's content to several rich text formats via the ExportTo*** methods.
This example is an illustration of the KA18639: How to export GridView rows and keep end-user modifications (such as sorting, grouping, filtering, selection) KB Article. Refer to the Article for an explanation.
Please note the following key moments:
- The GridView Extension should be defined via a separate PartialView without any additional tags (see the Using Callbacks help topic for more information);
- The GridView's PartialView should be wrapped within a form in order to apply the client layout state (sorting, filtering, etc.);
- An export trigger should submit this form to the corresponding Controller Action (i.e., make a POST request);
- The GridViewSettings (especially the Name property) should be the same in PartialView and Controller;
- The datasouce/Model should be the same in PartialView and Controller.
Question Comments
Added By: Nurhak Kaya at: 9/4/2012 7:58:55 AM
Really good! Thanks a lot!
Added By: Steven Jansick at: 7/11/2014 11:44:57 AMDoes this work when binding with BindToCustomData?
I have verified that all of the Conditions have been met but when I export, it is not maintaining the Grouping Order. Do you have any recommendations?
Added By: Mike (DevExpress Support) at: 7/14/2014 12:05:58 AMHello,
To process your recent post more efficiently, we copied it to a separate ticket created on your behalf: T128968: GridView - Export Data when using BindToCustomData method.
This ticket is currently in our processing queue. We will post to it as soon as we have any updates.
How I can send filter parameter to excel export function.
Here is my Button Code .cshtml view
@using (Html.BeginForm("ExportExcel", "Dataset", new { datasetID = Convert.ToInt64(ViewContext.RouteData.Values["datasetID"]) }))
{
Html.DevExpress().Button(settings =>
{
settings.Name = "btnExportDatasetData";
settings.Width = 100;
settings.Text = "Export to XLS";
settings.UseSubmitBehavior = true;
settings.Images.Image.IconID = IconID.ExportExporttoxls16x16office2013;
}).GetHtml();
}
Here is my Grid Code cshtml, what I want is to take parameters from grid Filter and pass it to my Controller
@Html.DevExpress().GridView(settings =>
{
settings.Name = "DatasetDataGrid";
settings.CallbackRouteValues = new { Controller = "Dataset", Action = "DatasetDataBindingPartial", datasetID = Convert.ToInt64(ViewContext.RouteData.Values["datasetID"]) };
settings.CustomBindingRouteValuesCollection.Add(GridViewOperationType.Paging, new { Controller = "Dataset", Action = "DatasetDataBindingPaging" });
settings.CustomBindingRouteValuesCollection.Add(GridViewOperationType.Sorting, new { Controller = "Dataset", Action = "DatasetDataBindingSorting" });
settings.CustomBindingRouteValuesCollection.Add(GridViewOperationType.Filtering, new { Controller = "Dataset", Action = "DatasetDataBindingFiltering" });
i want to put here Condition if user click on button then it take filter parameter, otherwise won't.
//if (settings.AfterPerformCallback != null)
{
settings.CustomBindingRouteValuesCollection.Add(GridViewOperationType.Filtering, new { Controller = "Dataset", Action = "ExportExcel" });
}
//settings.ClientSideEvents.EndCallback = "";
settings.Width = Unit.Percentage(100);
settings.Styles.Cell.CssClass = "CellsEllipsis";
settings.Settings.HorizontalScrollBarMode = ScrollBarMode.Visible;
settings.SettingsPager.PageSize = 50;
settings.SettingsPager.PageSizeItemSettings.Visible = true;
settings.SettingsPager.PageSizeItemSettings.Items = new string[] { "10", "20", "50", "100" };
settings.Settings.ShowFilterRow = true;
//settings.Settings.ShowFilterBar = GridViewStatusBarMode.Visible;
settings.Columns.Add(col =>
{
col.FieldName = "FactID";
col.Caption = "Fact ID";
});
if (Model != null && Model.Columns != null)
{
foreach (GridViewColumnState column in Model.Columns)
{
if (column != null)
{
if (column.FieldName != "FactID")
{
settings.Columns.Add(column.FieldName);
}
}
settings.Columns[settings.Columns.Count - 1].HeaderStyle.Font.Bold = true;
settings.Columns[settings.Columns.Count - 1].Width = Unit.Pixel(150);
}
}
settings.HtmlDataCellPrepared = (sender, e) =>
{
if (e.CellValue != null)
{
e.Cell.ToolTip = e.CellValue.ToString();
}
};
settings.ClientSideEvents.Init = "function(s,e) { s.PerformCallback(); }";
}).BindToCustomData(Model).GetHtml()
here is my Controller Action Method,
public ActionResult ExportExcel(Int64 datasetID, GridViewFilteringState filteringState)
{
var viewModel = GridViewExtension.GetViewModel("DatasetDataGrid");
viewModel.ApplyFilteringState(filteringState);
var results = DatasetDataBindingCoreExcel(viewModel);
DevExpress.Web.Mvc.GridViewSettings settings = new DevExpress.Web.Mvc.GridViewSettings();
settings.Styles.Header.BackColor = System.Drawing.ColorTranslator.FromHtml("#1E76AE");
settings.Styles.Header.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
settings.Styles.AlternatingRow.Enabled = DevExpress.Utils.DefaultBoolean.True;
settings.Styles.AlternatingRow.BackColor = System.Drawing.ColorTranslator.FromHtml("#D9E7FA");
settings.SettingsExport.RenderBrick = (sender, e) =>
{
DevExpress.Web.GridViewDataColumn dataColumn = e.Column as DevExpress.Web.GridViewDataColumn;
if (e.RowType == DevExpress.Web.GridViewRowType.Data &&
dataColumn != null &&
(dataColumn.FieldName.ToLower() == "iscurrent" || dataColumn.FieldName.ToLower() == "ispublished"))
{
e.TextValue = e.Value == DBNull.Value ? "False" : (Convert.ToBoolean(e.Value) ? "True" : "False");
}
};
//settings.Columns.Add("ProgrammeID");
settings.Name = "datasetExport";
DatasetModel obj = dsrepo.GetDatasetInfo(datasetID);
settings.SettingsExport.FileName = String.Format("{0}_{1}_{2}", obj.Title, obj.Code, DateTime.UtcNow.ToShortDateString());
//settings.CallbackRouteValues = new { Controller = "Exporting", Action = "ExportPartial" };
//settings.Width = DevExpress.Web.Unit.Percentage(100);
return Who.Xmart.Helpers.GridViewExportHelper.GridViewExport.ExportFormatsInfo[Helpers.GridViewExportHelper.GridViewExportFormat.Xlsx](settings, results);
//return Who.Xmart.Helpers.GridViewExportHelper.GridViewExport.ExportFormatsInfo[Helpers.GridViewExportHelper.GridViewExportFormat.Xlsx](settings, dsrepo.GetDatasetData(datasetID));
}
Added By: Jenny (DevExpress Support) at: 11/28/2016 10:10:20 PM
Hello Qasim,
I've created a separate ticket on your behalf (T456166: GridView - How to export the filtered grid to excel). It has been placed in our processing queue and will be answered shortly.
Added By: Nataly (DevExpress Support) at: 12/13/2016 9:30:13 AM
Hello,
I've created a separate ticket on your behalf (T462139: How to export GridView data to different text formats). It has been placed in our processing queue and will be answered shortly.
I have a Master-detail grid:
@Html.DevExpress().GridView(
settings =>
{
settings.Name = "grid";
settings.CallbackRouteValues = new { Controller = "UpcomingJoinees", Action = "BindGrdGetEmployees" };
settings.Width = Unit.Percentage(100);
settings.KeyFieldName = "EmployeeId";
settings.Columns.Add("EmployeeId");
settings.Columns.Add("BeaconId");
settings.Columns.Add("HireDate");
settings.Columns.Add("LastName");
settings.Columns.Add("FRSTNAME");
settings.Columns.Add("MIDLNAME");
settings.SettingsDetail.AllowOnlyOneMasterRowExpanded = false;
settings.SettingsDetail.ShowDetailRow = true;
settings.SettingsPager.EnableAdaptivity = true;
settings.Settings.ShowFilterRow = true;
settings.Settings.ShowFilterRowMenu = true;
settings.CommandColumn.ShowClearFilterButton = true;
settings.SetDetailRowTemplateContent(c =>
{
ViewContext.Writer.Write(
"Add Employee ITM's" +
"<br />" +
"<br />"
);
Html.RenderAction("TabControlPartial", new { EmployeeId = DataBinder.Eval(c.DataItem, "EmployeeId") });
});
}).Bind(Model.employees).GetHtml()
I need to export this grid in v14.1 .Please provide any s olution for the same.
RichEdit - How to save and load documents from a database
Load document:
- Pass a model with a binary property (rich text content to be displayed) to the RichEdit's PartialView.
- Use the RichEditExtension.Open method to open a new document with the specified/unique document ID and the necessary rich content type, and retrieve the binary content from the passed model (see the RichEditPartial source code file):
[C#]@Html.DevExpress().RichEdit(settings=>{settings.Name="RichEditNameHere";settings.CallbackRouteValues=new{Controller=...,Action="ActionMethodThatHandlesRichEditCallbacks"};}).Open(UNIQUE_DOCUMENT_ID_HERE,RICH_TEXT_FORMAT_HERE,()=>{returnMODEL_BINARY_PROPERTY_HERE;}).GetHtml()
[VB.NET]@Html.DevExpress().RichEdit( _Sub(settings) settings.Name = "RichEditNameHere" settings.CallbackRouteValues = NewWith {.Controller = "...", .Action = "ActionMethodThatHandlesRichEditCallbacks"}EndSub).Open(UNIQUE_DOCUMENT_ID_HERE, RICH_TEXT_FORMAT_HERE, _Function()Return MODEL_BINARY_PROPERTY_HEREEndFunction).GetHtml()
Save a document:
- Click the built-in toolbar's Save button/item.
- Use the RichEditSettings.Saving property to handle the DocumentManager.AutoSaving event.
- Retrieve the modified content via the RichEditExtension.SaveCopy method, save it to the related bound model's binary property, and set the EventArgs Handled property to True (see the HomeController source code file):
[C#]settings.Saving=(s,e)=>{byte[]docBytes=RichEditExtension.SaveCopy("RichEditName",DevExpress.XtraRichEdit.DocumentFormat.Rtf);DXWebApplication1.Models.DataHelper.SaveDocument(docBytes);e.Handled=true;};
[VB.NET]settings.Saving = Sub(s, e)Dim docBytes AsByte() = RichEditExtension.SaveCopy("RichEditName", DevExpress.XtraRichEdit.DocumentFormat.Rtf) DXWebApplication1.Models.DataHelper.SaveDocument(docBytes) e.Handled = TrueEndSub
See Also:
WebForms Version:
T352034: ASPxRichEdit - How to save and load documents from a database
Question Comments
Added By: Dave Smith 14 at: 1/7/2018 7:15:07 PM In this example, what triggers the Saving event? Can you provide an example that shows how custom Javascript can trigger the event without using another DevExpress component? I want to trigger it from a custom ribbon button or a separate HTML button.
Getting a summary value for a previous period while calculating the current one
Let us assume that we want to calculate the difference between the current and previous periods of time, and you want to allow end users to customize the resulting layout as they wish.
In this case, you should use the PivotGridControl.CustomCellValue (PivotGridControl.CustomCellDisplayText) event to calculate cell values. To access summary values for the previous period, you should create arrays of current row and column values, find a value that corresponds to the current period, and replace it with the one that corresponds to the previous period and call the PivotCellBaseEventArgs.GetCellValue method. You can access all field values via the PivotGridFieldBase.GetUniqueValues method.
See Also:
E1110: How to access other cell value while calculating the current cell
How to submit DataGrid model with form values
By default, HTML form collects information from all hidden inputs and posts it to the Controller. DataGrid is not an editor and doesn't have a hidden input. As a result, model values passed to the grid's DataSource are not passed to the server out of the box.
You can manually create hidden inputs for each row at runtime and place them to the form and specify their name attribute as demonstrated in the Model Binding in ASP.NET Core -> Binding to Collections help topic before it is submitted.
How to dynamically generate a report in a WPF application
The following steps are essential to create a report layout:
1. Create a report instance and bind it to data.
2. Add required bands to the report.
3. Add required controls to the created bands and provide data to them.
After the report layout is complete, you can generate the report document and display it in a Print Preview.
Starting with v.17.2, the report uses expression bindings to provide data to controls. You can switch to the legacy binding mode by setting the UserDesignerOptions.DataBindingMode property to Bindings at the application startup.
Report Server - How to manage scheduled jobs from a Windows Forms application
This example illustrates how to enable a client-side WinForms application to access the Report Server and remotely manage scheduled jobs.
For this application to be able to access the Report Server, make sure that the ServerAddress field in the application's MainForm.cs file matches the Site URL specified in your Report Server settings (it is set to "http://localhost:83" by default).
To log into the Report Server, the application uses the Guest account by default, so it is required that this user is active (you can check this in the User Accounts panel).
On running the application, the main form displays a complete list of currently scheduled tasks (jobs). After selecting a task, you can do one of the following.
- To manage a specific task, click "Show Scheduled Task Parameters". On the invoked form, you can create a new task, as well as update, delete or execute the selected task.
- To inspect the logs stored for a task, click "Show Scheduled Task Results". On the invoked form, you can view the history of task executions along with results of each execution.
The API that this application uses to access the Report Server is related to the following public namespaces.
- DevExpress.ReportServer.ServiceModel.ConnectionProviders
- DevExpress.ReportServer.ServiceModel.Client
- DevExpress.ReportServer.ServiceModel.DataContracts
To learn more about the corresponding infrastructure, please consult with the DevExpress product documentation.
Question Comments
Added By: Hitesh Parmar1 at: 1/9/2018 10:55:20 AM to view generated document,
winform code is
publicReportViewerForm(intreportId){
InitializeComponent();
remoteDocumentSource1.ServiceUri=MainForm.ServerAddress;
remoteDocumentSource1.AuthenticationType=AuthenticationType.Guest;
remoteDocumentSource1.ReportIdentity=newGeneratedReportIdentity(reportId);
remoteDocumentSource1.CreateDocument();
}
but I don't find equivalent documentviewer property of ReportIdentity& CreateDocument
My MVC code is
----------------------------
@Html.DevExpress().DocumentViewer(
settings =>
{
settings.Name = "DocumentViewer";
settings.SettingsRemoteSource.AuthenticationType = DevExpress.ReportServer.Printing.AuthenticationType.Windows;
settings.SettingsRemoteSource.ServerUri = http://servername
}).GetHtml()
How to implement an embedded Chart Control
To embed a chart into a container control in previous versions, you need to manually create a custom chart control that implements the IAnyControlEdit interface. See the example below for more details.
See also:
RepositoryItemAnyControl Class
Question Comments
Added By: Daniel Steinberger 1 at: 1/9/2018 11:48:54 PM Hi,
any row is showing the same chart data, was this intended?
Greetings
Daniel
How to align summary values displayed in a group row to the corresponding columns
This feature is available out-of-the-box starting from version 15.2 (the GridView.OptionsBehavior.AlignGroupSummaryInGroupRow property).
For earlier versions:
This is an example for the A1041 Knowledge Base article. Please refer to the article for the explanation. This example was updated to prevent overlapping of a summary text with the group row text when the first column width is reduced.
See also: How to print group summary values under corresponding columns.
Question Comments
Added By: Ken Yanovsky at: 6/5/2013 1:55:59 PM
In this example using item.GetDisplayText(values[item], false) from the GridGroupSummaryItem is brutally slow as internally it's doing a try/catch.
Unless that's fixed, it's a lot quicker to use the column's editor GetDisplayText method like so
view.Columns[item.FieldName].RealColumnEdit.GetDisplayText(values[item])
I used this example to set my summaries as well as to allowing me to paint the background color of specific grouped rows that were set in the gridView1_CustomDrawGroupRow event (I set the e.Appearance.BackColor which was then painted on with the Painter object). However I was not able to match the color of the row to the indent on the group level.
Is there anyway to do this?
Added By: Tony Tam 1 at: 9/12/2013 6:24:05 AMAlso these changes dont print out
Added By: Vivek Upadhyay 3 at: 2/12/2017 11:06:26 PM Hi Team,I am facing the following issue be following this approach:
Grid Control - If second column width is reduced, then it shows blank numbers
Currently I am facing following difficulty à there is a tradeoff between “allowing the Text to trim” and at the same time also “allow horizontal scrolling in case of Frozen Columns without having the text to overlap”
Fixing the former causes issue in the latter.
Please find below the code which is called when we reduce the Column Width (of say, second column or any column which is adjacent to a frozen column)
Pb3GridControl.cs à method CalcSummaryRect():
// This specifies the Column Rectangle whose width is being reduced
Rectangle result = GetColumnBounds(column);
SizeF sz = DevExpress.Utils.Text.TextUtils.GetStringSize(e.Graphics, text, e.Appearance.Font);
// This specifies the Width of the “Text” in the Above Column Rectangle
int width = Convert.ToInt32(sz.Width) + 1;
if (!gridInfo.ViewRects.FixedLeft.IsEmpty)
{
// This specifies the “TOTAL Width of the FROZEN Columns” , e.g. if only the 1st column say “totalcol” is Frozen, the fixedLeftRight specified the width of this column,
But if say more columns are Frozen, then fixedLeftRight will be summation of the widths of all the frozen columns
int fixedLeftRight = gridInfo.ViewRects.FixedLeft.Right;
//Here below signifies Column Rectangle’s Right – Width of Text – Total Width of Frozen Columns (i.e. Right for the FixedLeft Columns)
int marginLeft = result.Right - width - fixedLeftRight;
if (marginLeft < 0 && column.Fixed == FixedStyle.None)
return Rectangle.Empty;
}
Issue : The above "if condition" causes the Text NOT to Trim in case the Column Width is reduced. Instead an empty Rectangle is return.
If we comment out the "if condition", then Text Trimming will work fine, but if we have frozen columns and we do a horizontal scroll, in that case there will be text overlapping
Added By: Aleks (DevExpress Support) at: 2/13/2017 8:27:55 AM
Hello Vivek,
I can see that you have created a separate ticket for this issue - How to align summary values displayed in a group row to the corresponding columns. Let's continue our discussion here.
How to create a custom DialogService with custom commands
Starting from version 17.2.5 our DialogService supports custom UICommands. I should note that each UICommand should have the Id or Tag property set to MessageResult or DialogResult. Thus, creation of a custom dialog service is no longer required.
For earlier versions:
It is possible to specify what buttons should be shown by a dialog form associated with DialogService by passing MessageButton to the ShowDialog method. Such buttons are limited to a predefined set of values (OK, OKCancel, YesNoCancel, and YesNo). If you wish to create custom buttons with your own captions and associate them with the necessary custom commands, create a custom DialogService and pass a list of UICommands to the ShowDialog method.
This example shows how to implement such a service and register it. Here, by using a custom find dialog, you are able to locate the necessary record in the grid by using the data model's Id and focus it.
How to drag appointments data from the DataGrid and drop it onto the Scheduler Control
Note:This example is obsolete. Please review the How to drag appointments from GridView and drop them onto the Scheduler Control using SchedulerDragData example instead.
Demonstrates how to drag data from a DataGridView control which is bound to the Cars data table of Cars.mdb demo database and drop it to the SchedulerControl.
See Also:
How to detect which element of the Scheduler was clicked
Drag-n-drop and iCal import - import of the iCal file being dropped on XtraScheduler
How to display a warning tooltip when dragging an appointment to forbidden area
How to drag and relocate the entire series of recurring appointments
How to calculate a weighted average function
Sum (Unit Price * Units In Stock) / Sum (Units In Stock)
To solve this task, use any of the following approaches:
1. In the first report, the summaries are calculated at the level of a data source by using an SqlDataSource component to provide data to the report. The resulting query string is illustrated below:
To view the resulting query, right-click the the report data source in the Report Explorer (under the Components category) and invoke the Query Editor by clicking the ellipsis button for the Products query. To edit the query, click the Run Query Builder button that invokes the Query Builder dialog.[SQL]select sum([Products].[UnitsInStock]) as [Sum_UnitsInStock], [Products].[CategoryID], sum(([Products].[UnitPrice] * [Products].[UnitsInStock])) as [Sum_PriceInStock] from [Products] [Products] group by [Products].[CategoryID] order by [Products].[CategoryID] asc
2. In the second report, the group summaries are obtained by creating a calculated field with the following expression:
[][[CategoryID] == [^.CategoryID]].Sum([UnitPrice] * [UnitsInStock]) / [][[CategoryID] == [^.CategoryID]].Sum([UnitsInStock])
In the above expression, the '^' character is used to refer to the currently processed group.
Starting with v.17.2, you can calculate a weighted average at the report level by specifying a control's expression using several built-in report summary functions. See Calculating a Weighted Average Function to see step-by-step instructions for all available approaches.
ASPxRichEdit - How to insert a table based on a DataTable object
The first approach adds a custom "DOCVARIABLE" field to the document content on the client side, fills it with a required table in the server-side event handler, and removes this field after inserting the table on the client side. The table is inserted into the document by using the RichEditDocumentServer component - our non-visual document processing engine. See the Table API - How to display a DataTable example for more information.
The second approach initiates an AJAX request to get the table data in the JSON format on the client side. Then, the required table is created and filled with data on the client by using the ASPxRichEdit client-side API.
See also:
RichEdit - How to insert a table based on a DataTable object