doubt anyone knows the solution to this!

Discussion in 'ASP .Net' started by Guest, Feb 5, 2007.

  1. Guest

    Guest Guest

    working on a difficult problem, using crystal reports and when the report is
    exported for the file save it uses the name of the webform that the control
    is on, like default.aspx, but without the aspx. Anyway just wondering if
    there is a way to dymanically change the name of the form, for example to put
    the current date in it like (report022007).
    Guest, Feb 5, 2007
    1. Advertisements

  2. Guest

    Tim Mackey Guest

    hi paul,
    yes but you're talking to the entire internet so someone is bound to have
    found the problem before :)

    in your case, i am guessing that you are exporting a crystal report to PDF
    and sending it to the HttpResponse on the fly, with 'inline' instead of
    'attachment', so that it will open in the browser window rather than forced
    if this is true, then have a read of this discussion, which has an
    explanation and workaround for the way browsers embed PDF documents.

    let me know if this doesn't match your situation, and post some code too so
    we can see if there is something else you might be doing wrong.

    good luck
    Tim Mackey, Feb 6, 2007
    1. Advertisements

  3. Guest

    Guest Guest

    Hi Tim, thanks for the response. What you have assumed is correct, what I am
    trying to do. I will take a look at the reference you provided, thanks.
    Paul G
    Software engineer.

    Guest, Feb 6, 2007
  4. Guest

    Guest Guest

    Hi Tim, just had a quick question. Do you think I should try what is below,
    also not quite sure how to
    do this since, do you have to write code to save it to the server. Plus the
    response redirect have to
    occure in the export button callback, which I do not think we can access since
    it is a crystal report form that comes up.
    Suggestion__ save the PDF file to a temp
    folder within the web site, and just do a Response.Redirect to the pdf file.
    it displays inline, and it will retain the correct filename. i run a script
    every night on the server to clear out the temp folder
    Thanks again, Paul.
    Paul G
    Software engineer.

    Guest, Feb 6, 2007
  5. Guest

    Tim Mackey Guest

    hi paul,
    i guess you're using the crystal report viewer web control. in my case i
    was writing the code in a regular Button_Click event handler so i had no
    trouble with that. i haven't used the CR viewer web control so i'm not sure
    what's possible.

    here is the code i used anyway:
    crUnassigned_Audits rpt = new crUnassigned_Audits();
    .... databind the report ...
    string RelPath = String.Format("../Tmp/Unassigned_Audits_{0}.pdf",
    Response.Redirect(RelPath, true);

    hope it helps. you may be able to override the export button click event
    handler, if you wrote a new control based on the CR control, then you could
    use the code above to redirect the user to the report, and keep the file
    name for saving etc.


    Tim Mackey, Feb 6, 2007
  6. Guest

    Guest Guest

    Hi Tim thanks for the additional information. I thought that you had to use
    the crystal
    report viewer web control to display a crystal report on a webform
    but looks like that may not be the case. I will try something
    like what you have provided when I get time.
    Guest, Feb 7, 2007
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.