Microsoft.ReportViewer.WebForms nullable parameters checkbox doesn't clear parameter

Matthew Rikard 1 Reputation point
2022-12-05T18:11:00.193+00:00

With this latest release of Microsoft.ReportViewer.WebForms (150.1537.0), nullable parameters in the WebForms module have lost functionality. Prior to this release, if there were data in a nullable parameter and then the null checkbox was checked, the data in the parameter cleared out. Likewise when the checkbox was already checked and the user entered text into the parameter, the checkbox would uncheck itself.

This is no longer happening and is causing our users to run their reports in unexpected ways.

267323-image.png

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
3,061 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Anonymous
    2022-12-06T05:45:42.89+00:00

    Hi @Matthew Rikard
    According to the report viewer control's release notes, WebForms(150.1357.0) fixes issues with Null and datetime parameters.
    For more details, you can refer to this link: release-notes-ssrs-application-integration.
    Best regards,
    Aniya

    0 comments No comments

  2. Matthew Rikard 1 Reputation point
    2022-12-07T14:56:21.61+00:00

    Our DLL
    268237-image.png

    And here is a gif showing the current behavior
    268244-null-checkbox.gif

    Prior to this change, entering a value in a nullable field would uncheck the null checkbox
    Likewise, checking the null checkbox would remove the value in the nullable field
    This is causing our clients to be confused on what they are reporting.

    0 comments No comments

  3. Matthew Rikard 1 Reputation point
    2022-12-08T16:52:17.953+00:00

    For anyone else coming across this question, it is not resolved as the notes above state "WebForms(150.1357.0) fixes issues with Null and datetime parameters." as I believe this is a separate issue.
    We were able to implement a workaround hack by adding the following JavaScript on the page showing the report viewer

    function reportViewerNullBugWorkaround(id) {  
        if (!/cbNull$/.test(id)) {  
            return;  
        }  
      
        let cb = document.getElementById(id);  
        let tb = document.getElementById(id.replace("cbNull", "txtValue"));  
      
        if (!cb || !tb) {  
            return;  
        }  
      
        tb.addEventListener("keyup", function() {  
            if (tb.value) {  
                cb.checked = "";  
            } else {  
                cb.checked = "checked";  
            }  
        });  
      
        cb.addEventListener("change", function() {  
            if (cb.checked) {  
                tb.value = "";  
            }  
        });  
    }  
      
    document.addEventListener("DOMContentLoaded",function(){  
    	Array.from(document.querySelectorAll('input[type=checkbox]')).forEach((b) => { reportViewerNullBugWorkaround(b.id); });  
    });  
      
    

    However, we look forward to the proper solution when we will remove this workaround.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.