Crystal Reports Cascading parameters don't get preserved between postbacks

L

LP

I am using (trying to) CR version XI, cascading parameters feature works it
asks user to enter params. But if page is resubmitted. It prompts for params
again. I did set ReuseParameterValuesOnRefresh="True" in a viewer, but it
still doesn't work. Did anyone run into this problem. What's the solution?
Please help.

Thank you
 
B

Brian Bischof

You have to cache the report object. Save the report object to the Session()
collection and then restore it upon page refresh (be sure to explicity cast
it as a ReportDocument). ASP.NET reports do all kinds of funny things if you
don't save them between page refreshes.

HTH,

Brian Bischof
www.CrystalReportsBook.com
 
L

LP

Brian, I am not using ReportDocument object, I am setting viewers
ReportSource to a report file directly:

crViewer.ReportSource = Server.MapPath("Reports/" & reportName)

What should I do in this case?



Thanks
 
L

LP

Ok, I did change it to ReportDocument , and that worked for me even without
saving it to Session Variable. But now I am having another problem with
exporting. I have another button that export report to excel and sends a
file to a client, so now one parameterized report doesn't work. I tried
saving reportDoc and it ParameterFields to session and retrieving, but
nothing works.
I think CR is a very good product, very sharp looking reports (when you get
them to work), very slick designer especially version XI. But their API and
object hierarchy is terribly confusing and inconsistent with what one would
expect from .NET friendly product, I haven't seen any good documentation on
their APIs.
 
B

Brian Bischof

I agree about the confusing API. Have you seen my existing book, "Crystal
Reports .NET Programming"? It teaches you how to use the .NET object model
and has many tips and tricks for getting it to work. Anyway, it only touches
on the RAS and RDC programming a bit (I don't know if using that or not).
I'm going to do another book which is hardcore RAS programming because RAS
is extremely complicated to learn and program with.. But that won't be till
after I finish the CR XI book I'm working on now.

Anyway, to answer your question, the mistake most people make is that they
mix up the viewer object model with the report object model. They set some
properties using one object and set other properties using the other object
model. Then they get consfused when some of the properties get dropped. You
can only use ONE object model at a time. The best practice is to use the
ReportDocument object model (unless working with WebServices). Try that and
post the results here.

Brian Bischof
www.CrystalReportsBook.com
 
L

LP

The best practice is to use the
ReportDocument object model (unless working with WebServices). Try that and
post the results here.

ReportDocument did work for me for postback problems. But I also have a
button that exports report to excel and then sends this file to a client
through HTTP. I could not get that to work with one parameterized report.
Parameters don't seem to get cached with reportdocument. I tried my
different things, like caching actuall ParamFields object, etc. but nothing
seems to work.
I need this button because export in Crystal webviewer opens a popup window
with no toolbars, so users can't save it to a file. If I could find
workaround that, there would not be a need for this custom export button. My
biggest problem with Crystal right now is very simple but yet important
things take so much time effort to do that it becomes questionanle if it's
all worth it. And default behavior of Crystal is just bizarre like opening a
popup with no toolbars when exporting to another format, so file can't be
"save as"
 
B

Brian Bischof

Those are good points. Let me look into the export problem of not saving to
disk and see if I can get you an answer.

Brian
 
B

Brian Bischof

Hmmm. I'm looking over all your posts. The first post you had last week said
that you couldn't get the Save As dialog box to open. Instead, it always
spawned a new window. Now it seems that when you are in the new window it
won't allow saving the data. I assume this is a direct result of not being
able to solve the first problem. So here are my comments.

First is that if the export button doesn't open the Save/Open dialog box,
then I think it's a browser issue. For example, at the bottom of the dialog
box is a checkbox telling whether it should prompt you with this or not. I
played around with it for Excel and Word but this had no effect. I did find
out that I can change this with Adobe inside the Adobe Internet preferences.
After fixing that I got the Open/Save box for PDFs again. I looked in
preferences for Excel/Word and couldn't find such an option. Thus, the PDF
option makes me think that the browser is controlling this and not CR XI.
Overall, I have the Open/Save dialog popping up for all file types in my
brower and you should be able to get them too.

Re the Excel and Word browsers not letting you save data, this is happening
with my computer as well. However, again I have to question if this is a
browser issue or a CR XI issue since XI is just sending the XLS file to the
browser. I'll continue to play with it b/c I don't know the answer to this
one yet. But I think your best bet is to look at the first issue and get the
Open/Save dialog box to pop up by tweaking the IE settings.

HTH,

Brian Bischof
www.CrystalReportsBook.com
 
L

LP

Brian, Thanks for looking into this for me.
I think you understand my problem. But just to be clear:
When I click export button of a webviewer, it does open a popup window and
loads excel, word, etc. into the window. But there's no obvious way to save
it to a local drive as a file (other than copy and paste) And, yes, you are
right PDF is the only format with a toolbar that has "save as" icon. But I
think it's part of PDF object embedded within a browser. I also looked in
browser settings to make it open "save as" dialog box, but could not find
anything.
But I begin to doubt that it is a browser issue like you suggesting. I think
this behavior is controlled by HTTP header tags. I know that there's a
header tag content-type (or something like that) where you can specify
ms-excel, ms-word, etc. And there's also "attachment; filename=" tag where
you can give file name and browser then will prompt you to save or open that
file. So, I do think it's the way CR not providing the right HTTP header
tags for the popup is a root of the problem. So, I am thinking of
intercepting CR rendered HTML and modifying it, but I haven't had any time
to do anything serious like that, after all I am just building a demo app.
Let me know if you find anything else, or if I am on the right track.

Thank you again for your input.
 
B

Brian Bischof

Are you saying that you don't get the Open/Save dialog box or you do get it?
It seems that you don't get it at all. I get it on my computer and I think
this is a browser issue. As I said earlier, I was able to turn
enable/disable it using a PDF option. The second issue of the toolbar not
having the Save buttons could be a header issue. I'm not knowledgeable about
HTML headers but it does make sense that the header tags can control this. I
will have to research that tomorrow.

Brian Bischof
www.CrystalReportsBook.com
 
L

LP

Are you saying that you don't get the Open/Save dialog box or you do get
it?

I do NOT get it. When I click export icon it opens a popup window with
Excel, or Word embedded in the window, but no toolbars no nothing and
certainly NO "Save as" dialog box. If you could come up with a way to
provide users with ability to "save as" what's embedded inside a popup, I
would greatly appreciate it.

Thanks
 
B

Brian Bischof

Ok, that's what I thought. I think that is a browser issue b/c I was able to
toggle this feature on and off. For example, I can go into Adobe Properties
and turn this on and off using one of their options. When that dialog box
opens, there is a checkbox at the bottom about whether you should be
prompted with this box again or just open the file directly. Thus, this is a
browser setting. The header doesn't control it b/c on my computer I was able
to get the dialog box to come up or send it directly to a browser window
using and Adobe Properties setting. I would search Google to see how to turn
this on or off.

Brian
 
L

LP

For example, I can go into Adobe Properties
and turn this on and off using one of their options. When that dialog box
opens, there is a checkbox at the bottom about whether you should be
prompted with this box again or just open the file directly.

You are tweaking Adobe settings not the browser.
Thus, this is a
browser setting.
No, it's Adobe setting.

I can't find similar setting in browser or Excel Word either. And again lets
assume it's a browser setting, but that would default behavior of a browser.
So by default CR export functionality is unusable. I don't understand how CR
vendor (BusinessObjects as of today) could not see that someone would
actually want to save exported file, not just look at it in a popup window.
When I get a chance, I'll look into how to filter HTML rendered by CR and
modify it to enable save as functionality.
 
B

Brian Bischof

Man, we are really going around in circles about this one. I still say it's
a browser issue and not a Crystal problem. For example, if I go into my
browser and tell it to display large fonts, I can't then send emails to
every website I visit complaining that their web designers should use
smaller fonts. On my browser I get the Open/Save dialog box that you don't
get and I also see an option to turn it off. Thus, it works fine on my
browser and it appears to be a browser controlled setting. So how could it
be a Crystal problem?

That being said, I have no clue about how the Header record effects what the
browser does. Maybe Crystal is using a Header record that makes the
Open/Save dialog box optional? Maybe their header record is only compatible
with certain browser versions and doesn't work with others? I don't know.
This whole thing is getting very frustrating and I'm determined to figure
out what the heck is going on. Having it work one way in one browser and
another way in another browser and having no idea why is driving me crazy.
Somewhere there has to be a reasonable explanation for this problem you are
having.

Brian
 
L

LP

Brian, I am not dismissing that it could be a browser setting. If you or
someone else finds where to change this setting, that would be great. Are
you saying that you get Open/Save dialog box for all formats; MS Excel, Word
not just PDF? If it's true then what Version of browser are you using?
Thanks
 
R

Rob Diamant

Guys,

I have been following this thread for a while (it's entertaining, I can't
wait for the finish) and was wondering what code is behind LP's Export
Button that may be different then Brian's. Maybe you guys should compare.

Rob
 
B

Brian Bischof

I'm glad we are providing entertainment for everyone. ;-)

It's not a code problem. The problem is the ASP.NET viewer toolbar in XI.
The ironic thing is that I sent two emails to tech support and they were
thinking I was talking about the code too. Anyway, I heard back from a
support guy and he says that this behavior is controlled through the File
Types dialog box in Windows Explorer. I'm going to look into it and post his
full response once I check it out.

Oh yeah - re the Save/Open dialog box behavior, yes I get it for all file
types including Excel and Word. Anyway, I should be posting the resolution
shortly, and then we can all get back to our normal jobs! :)


Brian
www.CrystalReportsBook.com
 
B

Brian Bischof

After playing around with this it seems to work really well. In fact, I'm
even able to get the Excel export to open in Excel with a full toolbar. I
feel so much better now. Here is the resolution email. Play around with the
different checkboxes to get different results. This email is from the guy
that wrote the XI toolbar export functionality!

HTH,

Brian Bischof
www.CrystalReportsBook.com


-------------------
It sounds like the exporting is done through the viewer toolbar in a webform
viewer. The behavior is generic for IE and depends on whether user has
disabled the confirmation dialog, and whether the file is sent as
attachment. We send exported files inline, not as attachment, when
exporting through the viewer. You can change this behavior by adjusting the
user setting as below.

1. Open an Explorer window.
2. Select Tools | Folder Options (assuming Windows XP).
3. Select File Types tab.
4. Find the appropriate file type, click Advanced button.
5. Ensure "Confirm open after download" is checked.

There is a new method on ReportDocument.ExportToHttpResponse for developers
to control whether the exported file is sent as attachment.

I suspect the toolbar problem is because we turned off the IE menu in that
export window. There is no way to turn the menu on at this time.
 
L

LP

Brian, Wow!!! It worked!!!
Thanks a lot for getting this one resolved.


Brian Bischof said:
After playing around with this it seems to work really well. In fact, I'm
even able to get the Excel export to open in Excel with a full toolbar. I
feel so much better now. Here is the resolution email. Play around with the
different checkboxes to get different results. This email is from the guy
that wrote the XI toolbar export functionality!

HTH,

Brian Bischof
www.CrystalReportsBook.com


-------------------
It sounds like the exporting is done through the viewer toolbar in a webform
viewer. The behavior is generic for IE and depends on whether user has
disabled the confirmation dialog, and whether the file is sent as
attachment. We send exported files inline, not as attachment, when
exporting through the viewer. You can change this behavior by adjusting the
user setting as below.

1. Open an Explorer window.
2. Select Tools | Folder Options (assuming Windows XP).
3. Select File Types tab.
4. Find the appropriate file type, click Advanced button.
5. Ensure "Confirm open after download" is checked.

There is a new method on ReportDocument.ExportToHttpResponse for developers
to control whether the exported file is sent as attachment.

I suspect the toolbar problem is because we turned off the IE menu in that
export window. There is no way to turn the menu on at this time.

-------------------


Brian Bischof said:
I'm glad we are providing entertainment for everyone. ;-)

It's not a code problem. The problem is the ASP.NET viewer toolbar in XI.
The ironic thing is that I sent two emails to tech support and they were
thinking I was talking about the code too. Anyway, I heard back from a
support guy and he says that this behavior is controlled through the File
Types dialog box in Windows Explorer. I'm going to look into it and post his
full response once I check it out.

Oh yeah - re the Save/Open dialog box behavior, yes I get it for all file
types including Excel and Word. Anyway, I should be posting the resolution
shortly, and then we can all get back to our normal jobs! :)


Brian
www.CrystalReportsBook.com





could
should
be understand
how CR
and
should
be Thus,
this I
was how nothing
and way computer
and right
HTTP thinking haven't
had building the
new this
and question
if the
XLS problem But reportdocument.
If
I
could
find
workaround that, there would not be a need for this custom
export
button.
My
biggest problem with Crystal right now is very simple but
yet
important
things take so much time effort to do that it becomes
questionanle
if
it's
all worth it. And default behavior of Crystal is just
bizarre
like
opening
a
popup with no toolbars when exporting to another
format,
 
B

Brian Bischof

Pop open the champagne! It's time to celebrate!!!!!

:-D



LP said:
Brian, Wow!!! It worked!!!
Thanks a lot for getting this one resolved.


Brian Bischof said:
After playing around with this it seems to work really well. In fact, I'm
even able to get the Excel export to open in Excel with a full toolbar. I
feel so much better now. Here is the resolution email. Play around with the
different checkboxes to get different results. This email is from the guy
that wrote the XI toolbar export functionality!

HTH,

Brian Bischof
www.CrystalReportsBook.com


-------------------
It sounds like the exporting is done through the viewer toolbar in a webform
viewer. The behavior is generic for IE and depends on whether user has
disabled the confirmation dialog, and whether the file is sent as
attachment. We send exported files inline, not as attachment, when
exporting through the viewer. You can change this behavior by adjusting the
user setting as below.

1. Open an Explorer window.
2. Select Tools | Folder Options (assuming Windows XP).
3. Select File Types tab.
4. Find the appropriate file type, click Advanced button.
5. Ensure "Confirm open after download" is checked.

There is a new method on ReportDocument.ExportToHttpResponse for developers
to control whether the exported file is sent as attachment.

I suspect the toolbar problem is because we turned off the IE menu in that
export window. There is no way to turn the menu on at this time.

-------------------


post
his into
my emails
to
on
my effects
what browser
and problem
you should
by
CR I
was should
computer
I see
how or
you a
way
inside
a or
you "save
as" I
also you
can to
save you
had
again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top