Back to Devexpress

ReportDesignerDataSourceSettings Class

xtrareports-devexpress-dot-xtrareports-dot-web-dot-reportdesigner-4a7bd1ee.md

latest6.8 KB
Original Source

ReportDesignerDataSourceSettings Class

Contains settings that allow you to hide data source actions from the Field List panel (part of the Web End-User Report Designer).

Namespace : DevExpress.XtraReports.Web.ReportDesigner

Assembly : DevExpress.XtraReports.v25.2.Web.WebForms.dll

NuGet Package : DevExpress.Web.Reporting

Declaration

csharp
public class ReportDesignerDataSourceSettings :
    PropertiesBase,
    IPropertiesOwner
vb
Public Class ReportDesignerDataSourceSettings
    Inherits PropertiesBase
    Implements IPropertiesOwner

The following members return ReportDesignerDataSourceSettings objects:

LibraryRelated API Members
.NET Reporting ToolsASPxReportDesigner.SettingsDataSource
ASP.NET MVC ExtensionsReportDesignerSettings.SettingsDataSource

Remarks

The ReportDesignerDataSourceSettings contains settings that allow you to hide actions in the Field List.

The following image demonstrates actions available in the Field List panel:

The following code hides the Add Data Source button and UI elements that allow the user to change and delete the data source and queries in the Field List:

csharp
@using ReportWizardCustomizationServiceMvcExample.Models
@model ReportDesignerModel

<script type="text/html" id="instant-report">
    <svg viewBox="-2 -5 32 32" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
        <g id="Layer_1" transform="translate(-2, -5)" style="enable-background:new 0 0 32 32">
            <g id="Check">
                <polygon class="dxd-icon-fill" points="27,5 11,21 5,15 2,18 11,27 30,8 " fill="#727272" />
            </g>
        </g>
    </svg>
</script>

<script type="text/html" id="wizard-labels-page">
    <div class="dxrd-wizard-type-page dxrd-wizard-type-page-labels">
        <div class="page-title">Custom Wizard Page</div>
        <div class="dx-fieldset">
            <div class="dx-field">
                <div class="dx-field-label">Report Name</div>
                <div class="dx-field-value">
                    <div data-bind="dxTextBox: { value: label4Value }"></div>
                </div>
            </div>
            <div class="dx-field">
                <div class="dx-field-label">Label1: </div>
                <div class="dx-field-value">
                    <div data-bind="dxTextBox: { value: label1Value }"></div>
                </div>
            </div>
            <div class="dx-field">
                <div class="dx-field-label">Label2: </div>
                <div class="dx-field-value">
                    <div data-bind="dxTextBox: { value: label2Value }"></div>
                </div>
            </div>
            <div class="dx-field">
                <div class="dx-field-label">Label3: </div>
                <div class="dx-field-value">
                    <div data-bind="dxTextBox: { value: label3Value }"></div>
                </div>
            </div>
        </div>
    </div>
</script>

<link href="~/Content/reportWizardCustomization.css" rel="stylesheet" />

<script src="~/Scripts/reportWizardCustomization.js"></script>

@Html.DevExpress().ReportDesigner(settings => {
    settings.Name = "ReportDesigner1";

    settings.ClientSideEvents.CustomizeWizard = "CustomizeReportWizard";

    settings.SettingsDataSource.AllowAddDataSource = false;
    settings.SettingsDataSource.AllowEditDataSource = false;
    settings.SettingsDataSource.AllowRemoveDataSource = false;

    // Add the created data source to the list of default data sources.
    foreach (var dataSourceItem in Model.DataSources)
        settings.DataSources.Add(dataSourceItem.Key, dataSourceItem.Value);
    }).BindToUrl("TestReport").GetHtml()
csharp
public async Task<IActionResult> Designer(
    [FromServices] IReportDesignerClientSideModelGenerator clientSideModelGenerator,
    [FromQuery] string reportName) {
    Models.ReportDesignerCustomModel model = new Models.ReportDesignerCustomModel();
    model.ReportDesignerModel = await CreateDefaultReportDesignerModel(clientSideModelGenerator, reportName, null);
    model.ReportDesignerModel.DataSourceSettings.AllowAddDataSource = false;
    model.ReportDesignerModel.DataSourceSettings.AllowEditDataSource = false;
    model.ReportDesignerModel.DataSourceSettings.AllowRemoveDataSource = false;
    return View(model);
}
html
<dx-report-designer [reportUrl]="reportUrl" height="calc(100vh - 90px)">
    <dxrd-request-options [getDesignerModelAction]="getDesignerModelAction" [host]="hostUrl"></dxrd-request-options>
    <dxrd-designer-model-settings [allowMDI]="true">
        <dxrd-datasource-settings [allowAddDataSource]="false" [allowEditDataSource]="false" [allowRemoveDataSource]="false"></dxrd-datasource-settings>
    </dxrd-designer-model-settings>
    <dxrd-callbacks (CustomizeWizard)="OnCustomizeReportWizard($event)">
    </dxrd-callbacks>
</dx-report-designer>

The Field List with hidden actions is shown in the following image:

View Example: Reporting for Web (ASP.NET MVC, ASP.NET Core and Angular) - How to Use the Report Wizard Customization API and Hide Data Source Actions in Report Designer

Inheritance

Object StateManager PropertiesBase ReportDesignerDataSourceSettings

See Also

ReportDesignerDataSourceSettings Members

DevExpress.XtraReports.Web.ReportDesigner Namespace