1
votes

I need reportviewer control in my ASP.net MVC3 application. VS2010 ReportViewer V10.0

I tried using following solution. I created user control and put reportviewer control there.

How can I use a reportviewer control in an asp.net mvc 3 razor view?

Code is same as shown in above link.

The problem is, - if I hit next page or last page, it stays there only. - if I allow user to enter parameter and than click view report button on report viewer, it does nothing.

I know the reason, its losing its state. Its postback issue. If its regular aspx page i can control that in page_load by "!IsPostBack" but how to do that in user control. I tried putting IsPostback on control page_load but its always false.

My code is same as listed in above link. I am using user control.

Any solution?

1

1 Answers

2
votes

This will do the trick and make IsPostBack=true on post back:

<script runat="server">
    private void Page_Init(object sender, System.EventArgs e)
    {
        Context.Handler = this.Page;
    }
</script>