This is a migrated thread and some comments may be shown as answers.

ReportViewer UpdateUI fires multiple times

1 Answer 128 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Danilo
Top achievements
Rank 1
Danilo asked on 27 Jul 2015, 02:41 PM

I have a ReportViewer in my WinForms application to show some data in the form of a Telerik Report. I also have some textboxes, which will update the Report when the user leaves the textbox and the text has been changed.

private void SpediControl_Leave(object sender, EventArgs e)
{
    Control ct = sender as Control;
 
    // check if text in textbox has been changed
    if (ct.Text != s) // s is the text of the textbox
    {
        // update spedi report
        InstanceReportSource repSrcSpedi = new InstanceReportSource();
        repSrcSpedi.ReportDocument = new Spedi(this);
        repViewerSpediPreview.ReportSource = repSrcSpedi;
        repViewerSpediPreview.RefreshReport();
    }
}

After​ leaving a textbox, the ReportViewer gets the focus on itself. So I'm using UpdateUI event. To test if it gets fired, I just call a MessageBox:

private void repViewerSpediPreview_UpdateUI(object sender, EventArgs e)
{
    MessageBox.Show("aaa");
}

To my surprise, the message box gets called 8 times. First, I thought the "_Leave()" event must have an error. But the Leave event is only triggered once (as expected). It's only the UpdateUI event which is triggered multiple times. Everything else is working as expected. Is this a known bug or can anyone please provide me some help?

Regards,
Danilo

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 29 Jul 2015, 09:13 AM
Hi Danilo,

The expected behavior is to have multiple calls to the viewer's UpdateUI event for each part of the viewer (document map, parameters area, page area, etc.). If you need to move the focus from the viewer after refresh, please use the approach discussed in the Lose focus on active control when calling RefreshReport() method for ReportViewer forum thread.

Let us know if you need any further help.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Danilo
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or