2010-06-18 91 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