C1Dialog show vs ShowOnLoad in RowCommand and hide in Close action 2025v2 399

Posted by: enrique.pv-ext on 25 March 2026, 11:19 am EST

    • Post Options:
    • Link

    Posted 25 March 2026, 11:19 am EST

    Hi,

    Migrate from 2010v1 to 2025v2 399 in ASP.NET WebForms NET Framework 4.8.1.

    Migrating C1Window to C1Dialog 2025v2 399.

    Using C1Dialog from C1.Web.Wijmo.Controls.48.dll

    I use UserControl for ReportViewer + C1Dialog:

     C1GridView1_RowCommand: 
                    ReportViewerUC.ShowReport(report, exportedFileName);

    ShowOnLoad problem: show Dialog for each postback !!

    public void ShowReport(C1ReportV48.C1Report report, string exportedFileName, bool fullScreen = false, string zoom = "100%")
            {
                string docKey = "report";
                C1ReportViewer.RegisterDocument(docKey, () => report);
                ReportViewer.ReportName = docKey;
                ReportViewer.FileName = docKey; 
                ReportViewer.ExportedFileName = exportedFileName;
                ReportViewer.FullScreen = fullScreen;
                ReportViewer.Zoom = zoom;
    
                ReportDialog.ShowOnLoad = true;
    
                UpdatePanelReport.Update();
            }

    How-to reset “state” for C1Dialog (in my usercontrol) ?

    not use ShowOnLoad , any “Show” method ?

    and when I click X (pin close), hide o close de Dialog, and reset state to hidden…

    any good practices for Show/Open and Hide/Close the C1Dialog control ?

    thanks a lot!!

  • Posted 26 March 2026, 4:58 am EST

    I try this using c1dialog open

               ReportDialog.ShowOnLoad = false;
                ScriptManager.RegisterStartupScript(
                    this,
                    this.GetType(),
                    "openDialog",
                    "Sys.Application.add_load(function(){ $('#" + ReportDialog.ClientID + "').c1dialog('open'); });",
                    true
                );

    NOT working, if I do again postaback async partial (Search button), it’s appears popup C1Dialog.

    Only should be appears when I click action OnRowCommand…

            public void ShowReport(C1ReportV48.C1Report report, string exportedFileName, bool fullScreen = false, string zoom = "100%")
            {
                string docKey = "report";
    
                // Registrar documento dinámico
                C1ReportViewer.RegisterDocument(docKey, () => report);
    
                ReportViewer.ReportName = docKey;
                ReportViewer.FileName = docKey; 
                ReportViewer.ExportedFileName = exportedFileName;
    
                ReportViewer.FullScreen = fullScreen;
                ReportViewer.Zoom = zoom;
    
    
                ReportDialog.ShowOnLoad = false;
                ScriptManager.RegisterStartupScript(
                    this,
                    this.GetType(),
                    "openDialog",
                    "Sys.Application.add_load(function(){ $('#" + ReportDialog.ClientID + "').c1dialog('open'); });",
                    true
                );
    
    
                UpdatePanelReport.Update();
            }

    Any suggestions, please?

    Any help very appreciated will be

    Thanks a lot

  • Posted 27 March 2026, 2:55 am EST

    Hello Enrique,

    The sample we shared in the following thread of yours has the same implementation as you described here:

    https://developer.mescius.com/forums/webforms-edition/good-patterns-practices-for-c1reportviewer-registerdocument-2025v2-399

    However, in our sample we don’t observe C1Dialog displaying on postback. Could you please test our sample and let us know if it reproduces the behavior?

    • If it does, please share the exact step to reproduce the behavior for us to investigate and suggest you best approach to handle it.

    • If it does not, please update our sample with your implementation so that it replicates the behavior for further investigation.

    Regards,

    Uttkarsh.

  • Posted 30 March 2026, 4:49 am EST

    the exact step to reproduce the behavior

    1. click show Report button for row 1
    2. the ReportViewer popup is open
    3. closes the popup
    4. click page 2 (pagination)
    5. the popup appears again !!
  • Posted 31 March 2026, 1:54 am EST

    Hello Enrique,

    The problem is that ReportDialog.ShowOnLoad = true is being set in RowCommand, and this value is persisted in ViewState. When you click page 2, a postback occurs, the dialog’s ShowOnLoad is still true from ViewState, and it re-opens the popup.

    Fix: Reset ReportDialog.ShowOnLoad = false in Page_Load (or Page_Init) on every postback, so it only fires when explicitly triggered by RowCommand.

    In Default.aspx.cs:

    csharpprotected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            var dt = BuildDataSource();
            Session[SESSION_DATA_SOURCE] = dt;
    
            string allIds = string.Join(",",
                dt.AsEnumerable().Select(r => r["ID"].ToString()));
    
            HSelectionAll.Value = "false";
            HSelected.Value     = "";
            HUnselected.Value   = allIds;
            HAllItems.Value     = allIds;
    
            BindGrid(dt);
        }
        else
        {
            // *** FIX: Always reset the dialog on every postback.
            // RowCommand will set it back to true only when a report button is clicked.
            ReportDialog.ShowOnLoad = false;
        }
    }

    Please let us know if you still face the issue at your end.

    Regards,

    Uttkarsh.

  • Posted 31 March 2026, 2:46 am EST

    Great, that working

    I was trying:

            public void ShowReport(C1ReportV48.C1Report report, string exportedFileName, bool fullScreen = false, string zoom = "100%")
            {
                string docKey = "report";
    
                // Registrar documento dinámico
                C1ReportViewer.RegisterDocument(docKey, () => report);
    
                ReportViewer.ReportName = docKey;
                ReportViewer.FileName = docKey;
                ReportViewer.ExportedFileName = exportedFileName;
    
                ReportViewer.FullScreen = fullScreen;
                ReportViewer.Zoom = zoom;
    
    
                ReportDialog.ShowOnLoad = false;
    
                var script = @"
                            function openDialogForReportViewer() {
                                var windowId = '" + ReportDialog.ClientID + @"';
                			    var dialog = $(""#"" + windowId);
                                if (dialog) {
                                        dialog.c1dialog({
                                            title: 'ReportViewer',
                                            modal: true
                                        });
                                        dialog.c1dialog({ position: 'center' });
                                        dialog.c1dialog('open');
                                        console.log('ShowReport. Dialog ejecutado correctamente.');
                                } else {
                                    console.warn('ShowReport. Componente no encontrado: " + ReportDialog.ClientID + @"');
                                }
    
                               Sys.Application.remove_load(arguments.callee);  
                            }
                            Sys.Application.add_load(openDialogForReportViewer);
                        ";
    
                ScriptManager.RegisterStartupScript(Parent.Page, GetType(), Guid.NewGuid().ToString(), script, true);
    
                UpdatePanelReport.Update();
            }
  • Posted 31 March 2026, 3:08 am EST

    Hello Enrique,

    We’re glad that solution works for you.

    Please let us know if you observe any other issue.

    Regards,

    Uttkarsh.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels