Pesky NULL checkbox in SSRS report

杀马特。学长 韩版系。学妹 提交于 2020-01-04 14:22:13

问题


I'm using the ReportViewer control in a WinForms app. How do I change the "NULL" checkbox text to anything else? (just right of 'Begin Date' in the below picture)

alt text http://img269.imageshack.us/img269/1774/dropdowninssrspagerequi.png


回答1:


Here's the answer, and it's a bit ugly, but hopefully this will save you some typing if you ever have to do it yourself. Implement the IReportViewerMessages interface like so:

public class CustomReportViewerMessages : IReportViewerMessages
{
    public string NullCheckBoxText { get { return "All"; } }
    public string NullCheckBoxToolTip { get { return "All"; } }

    public string DocumentMapButtonToolTip { get { return "DocumentMapButtonToolTip"; } }
    public string ParameterAreaButtonToolTip { get { return "ParameterAreaButtonToolTip"; } }
    public string FirstPageButtonToolTip { get { return "FirstPageButtonToolTip"; } }
    public string PreviousPageButtonToolTip { get { return "PreviousPageButtonToolTip"; } }
    public string CurrentPageTextBoxToolTip { get { return "CurrentPageTextBoxToolTip"; } }
    public string PageOf { get { return "PageOf"; } }
    public string NextPageButtonToolTip { get { return "NextPageButtonToolTip"; } }
    public string LastPageButtonToolTip { get { return "LastPageButtonToolTip"; } }
    public string BackButtonToolTip { get { return "BackButtonToolTip"; } }
    public string RefreshButtonToolTip { get { return "RefreshButtonToolTip"; } }
    public string PrintButtonToolTip { get { return "PrintButtonToolTip"; } }
    public string ExportButtonToolTip { get { return "ExportButtonToolTip"; } }
    public string ZoomControlToolTip { get { return "ZoomControlToolTip"; } }
    public string SearchTextBoxToolTip { get { return "SearchTextBoxToolTip"; } }
    public string FindButtonToolTip { get { return "FindButtonToolTip"; } }
    public string FindNextButtonToolTip { get { return "FindNextButtonToolTip"; } }
    public string ZoomToPageWidth { get { return "ZoomToPageWidth"; } }
    public string ZoomToWholePage { get { return "ZoomToWholePage"; } }
    public string FindButtonText { get { return "FindButtonText"; } }
    public string FindNextButtonText { get { return "FindNextButtonText"; } }
    public string ViewReportButtonText { get { return "ViewReportButtonText"; } }
    public string ProgressText { get { return "ProgressText"; } }
    public string TextNotFound { get { return "TextNotFound"; } }
    public string NoMoreMatches { get { return "NoMoreMatches"; } }
    public string ChangeCredentialsText { get { return "ChangeCredentialsText"; } }
    public string NullValueText { get { return "NullValueText"; } }
    public string TrueValueText { get { return "TrueValueText"; } }
    public string FalseValueText { get { return "FalseValueText"; } }
    public string SelectAValue { get { return "SelectAValue"; } }
    public string UserNamePrompt { get { return "UserNamePrompt"; } }
    public string PasswordPrompt { get { return "PasswordPrompt"; } }
    public string SelectAll { get { return "SelectAll"; } }
    public string PrintLayoutButtonToolTip { get { return "PrintLayoutButtonToolTip"; } }
    public string PageSetupButtonToolTip { get { return "PageSetupButtonToolTip"; } }
    public string TotalPagesToolTip { get { return "TotalPagesToolTip"; } }
    public string StopButtonToolTip { get { return "StopButtonToolTip"; } }
    public string DocumentMapMenuItemText { get { return "DocumentMapMenuItemText"; } }
    public string BackMenuItemText { get { return "BackMenuItemText"; } }
    public string RefreshMenuItemText { get { return "RefreshMenuItemText"; } }
    public string PrintMenuItemText { get { return "PrintMenuItemText"; } }
    public string PrintLayoutMenuItemText { get { return "PrintLayoutMenuItemText"; } }
    public string PageSetupMenuItemText { get { return "PageSetupMenuItemText"; } }
    public string ExportMenuItemText { get { return "ExportMenuItemText"; } }
    public string StopMenuItemText { get { return "StopMenuItemText"; } }
    public string ZoomMenuItemText { get { return "ZoomMenuItemText"; } }
    public string ViewReportButtonToolTip { get { return "ViewReportButtonToolTip"; } }
}

Then, use an instance of that class right before you RefreshReport:

                reportViewer.Messages = new CustomReportViewerMessages();
                reportViewer.RefreshReport();

And that'll do it. Notice I've left almost all the properties as meaningless strings, except the two (at top) that I care about.




回答2:


Edit the report and uncheck the 'Allow NULL value' checkboxes for those parameters. You can use the 'Allow blank value' without the additional checkboxes displaying.



来源:https://stackoverflow.com/questions/3072245/pesky-null-checkbox-in-ssrs-report

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!