Solved

ASP.NET 2.0 Control Javascript IFRAME

Posted on 2007-03-19
7
1,824 Views
Last Modified: 2012-06-21
I have an asp.net 2.0 ReportViewer control.  Even if you have never used this control you could probably help me with my problem.  I have this control included on my webpage, along with some other dropdowncontrols.  On postback of one of the dropdown controls, apparantly this causes the reportviewer to dispose and has to be recreated.  This isn't desired.  So my two inital thoughts were to cache the reportviewer and then set it back but you would notice a flickr.  My other thought was to put this in an iframe.  But I need to pass ReportParameters to this page?  How would I do this?  Could I do this in Javascript to send an actual object?  I'm leaning towards the IFRAME solution but I do not know how to pass this ReportParameters object to my page within the IFRAME.
0
Comment
Question by:cophi
  • 3
  • 3
7 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 18748574
The IFRAME does not really help because it brings new problems by handling TWO windows with separate documents and forms.

The solution for not refreshing the page would be AJAX, but that is only a buzz word when you did not use it before. It brings you more problems then solutions.

So I do not know how to help you easily :(

0
 
LVL 15

Expert Comment

by:stanscott2
ID: 18748617
I really don't advise you to use an IFRAME, because you'll spend a lot of time and effort trying to force this into the overall ASP.NET 2.0 framework, and I'm not sure it will work anyway.

The solution to this, I think, is in the ASP.NET code that uses the ReportViewer control.  If you don't need to redraw the ReportViewer, you should be doing something like:

if (!IsPostback)
{
     // code to bind the ReportViewer control to the data
}
// otherwise nothing

in C#.

However, postback always causes the page to reload, unless you're using AJAX, so there will always be SOME flicker (less than ideal, I know).

If you're stuck and want to post some of your ASP.NET code, I'll be happy to take a look at it.
0
 

Author Comment

by:cophi
ID: 18750927
Ok well I have a asp.net 2.0 report viewer control that I do NOT want to be reload/refresh on Postback so what is the best method for doing this.  i figured putting this control in a seperate frame would be best?  any better ideas?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:cophi
ID: 18751097
basically i have 5 controls on the page... a few of them cause a post back.... but i want the report viewer control to keep the same state, I don't want it to reload.  see what i'm saying
0
 
LVL 15

Expert Comment

by:stanscott2
ID: 18751237
Yes, I understood your problem before, and I suggested that you need to revise your ASP.NET code.  If you show some of it, I can maybe help you with more specifics.
0
 

Author Comment

by:cophi
ID: 18751263
stanscott2,

I understand what your are saying with your code example.  the problem is when one of the controls refreshs the page, the report viewer is going to have to redraw and reget the report.  It just has to, zero way around it.  I know that much.  so just putting some code not in postback won't help.  
0
 
LVL 15

Accepted Solution

by:
stanscott2 earned 500 total points
ID: 18752329
But, if you know that a postback is necessary, and you know that the report viewer is going to redo the report, what's the question?  There will inevitably be flicker, whether you put the report into an iframe or not.  That's the nature of .NET -- postbacks == reloads.

The Ajax approach is to make a back-end request and replace the current HTML inside a DIV or SPAN with something new.  If you want to address this, explore Microsoft AJAX, but this will take a good bit of rewriting.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now