2010-06-18 139 views

回答

2

下面是答案,它有点难看,但希望这会为您节省一些打字费用,如果您需要自己做。实现IReportViewerMessages接口,像这样:

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"; } } 
} 

然后,你RefreshReport之前使用的是正确的类的实例:

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

这会做到这一点。注意我几乎把所有的属性都当作无意义的字符串,除了我关心的两个(顶部)。

1

编辑的报告,并取消选中“允许空值”复选框这些参数。您可以使用“允许空白值”,而不显示额外的复选框。

+0

空白不是空的相同,我不得不改变我所有的查询? – 2010-06-18 20:33:21

+1

正确,它不一样。您可能会也可能不需要更改查询,我不能说。您可以通过检查查询中的LEN来始终将变量清空。无论如何,这是我知道删除盒子并且仍然不需要价值的唯一方法。 – Kenneth 2010-06-18 20:41:04

+1

另外,我不能让float/date为null。所以我必须在查询中进行一些解析 – 2010-06-21 14:04:45