crystal report parameters on post back event

Last post 07-03-2009 12:21 PM by kaushalparik27. 10 replies.

Sort Posts:

  • crystal report parameters on post back event

    07-02-2009, 5:46 PM
    • Member
      7 point Member
    • momer123
    • Member since 10-29-2008, 1:14 PM
    • Posts 84

    Hi, I am calling bindReport function in page load event and passing one parameter in that function, report works fine at the first time it loads but on post back event of the page its asking me for parameter even i am calling the same bindReport function on post back event which sets the parameters as well?

    Anyone knows why its asking me to set parameters which have already been set on post back event of the page?

     

     

     

  • Re: crystal report parameters on post back event

    07-03-2009, 1:27 AM
    • Contributor
      2,624 point Contributor
    • CoolBond
    • Member since 10-25-2007, 1:34 PM
    • Country
    • Posts 518

     Hi,

            You need to bind the report source for every postback( i.e you cant bind in !IsPostback condition). If you post your code or elaborate how you are using the report function, it would helpful for me to help you.

     

     

    Hope this will help you....

    " If people criticize you, hurt you, or shout at you,Don't be bothered. Just remember, In every game, audience make the noise, not the players "
  • Re: crystal report parameters on post back event

    07-03-2009, 1:41 AM
    Answer

    Depending on your method of populating the report, the CrystalReportsViewer  control may not know the LoginInfo or the Parameters.  You need to tell the report viewer control what the log on info and what the parameters are and then it would work fine in between postbacks.

    try some work-a-round:

    [1] try to bind the report in Page_Init mathod instead of Pag_load method (out of the Page.IsPostBack check)

    [2] try setting ReuseParameterValuesOnRefresh="True"


    hope it helps./.

    नमस्ते,
    [KaushaL] || BloG || MS MVP

    "I would love to change the world, but they won’t give me the source code"


    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers.
  • Re: crystal report parameters on post back event

    07-03-2009, 7:40 AM
    • Member
      7 point Member
    • momer123
    • Member since 10-29-2008, 1:14 PM
    • Posts 84

    Hi kaushalparik27,

    Thanks for your reply. This issue has now been fixed by binding report in page_Init event instead of binding it in page_load event.

    I have other question regarding printer option page which pop up when i click on print button on crystalreportviewer  and when i click okay on that pop up page it displays print preview of the report.

    Q1. Is there any way to skip that pop up window(Printer Option) and just display print preview screen instead?

    Q2. Can i see that print preview screen of the report from button_click event? I want to display print preview screen when i click on button instead of displaying report first and then click print button and then click Ok on pop up window screen?

    Thanks

  • Re: crystal report parameters on post back event

    07-03-2009, 7:57 AM
    Answer

    momer123:
    Q1. Is there any way to skip that pop up window(Printer Option) and just display print preview screen instead?

    what is actually being displayed after the Printer Option window > is your report exported in PDF format (as print preview).

    you can have a button and in its client event you can export the report in pdf format and display in another window. this would behave same as Print Preview (which is they also doing in the same way > exporting the report to PDF to show print preivew).

    below is code to export report docuement in PDF:

    //set the export options to PDF
    ExportOptions exportOpts = doc.ExportOptions;
    exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;
    exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
    exportOpts.DestinationOptions = new DiskFileDestinationOptions();

    // Set the disk file options.
    DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
    ((DiskFileDestinationOptions)doc.ExportOptions.DestinationOptions).DiskFileName = Server.MapPath("~/DesktopModules/OnlineForm/OnlineForm.pdf");
    //export the report to PDF rather than displaying the report in a viewer
    doc.Export();

    //force download dialog to download the PDF file at user end.
    //Set the appropriate ContentType.
    Response.ContentType = "Application/pdf";
    //Get the physical path to the file.
    string FilePath = Server.MapPath("~/DesktopModules/OnlineForm/OnlineForm.pdf");
    //Write the file directly to the HTTP content output stream.
    Response.WriteFile(FilePath);
    Response.End();


    Referenced Link > Create PDF files on-the-fly in ASP.NET (Using Crystal Report!)


    hope it helps./.

    नमस्ते,
    [KaushaL] || BloG || MS MVP

    "I would love to change the world, but they won’t give me the source code"


    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers.
  • Re: crystal report parameters on post back event

    07-03-2009, 9:09 AM
    • Member
      7 point Member
    • momer123
    • Member since 10-29-2008, 1:14 PM
    • Posts 84

    Hi, I don't want to create PDF file physically and save on hard disk becuase its gona be waste of space.

    Q1. When crystal report displays preview, does it first create the pdf file pgysically and save on hard disk?

     

  • Re: crystal report parameters on post back event

    07-03-2009, 9:23 AM
    Answer

    momer123:
    I don't want to create PDF file physically and save on hard disk becuase its gona be waste of space.

    there can be alternatives

    [1] you can delete the PDF file every time before creating one. this way there will be only one file at a time at your application folder

    [2] dont save the PDF file physically; Render it directly on a popup browser window as PDF file.


    momer123:
    Q1. When crystal report displays preview, does it first create the pdf file pgysically and save on hard disk?

    NO. it does create a PDF file and render it in browser. It doesnt create physically (just like second alternative above.)


    hope it helps./.


    नमस्ते,
    [KaushaL] || BloG || MS MVP

    "I would love to change the world, but they won’t give me the source code"


    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers.
  • Re: crystal report parameters on post back event

    07-03-2009, 9:57 AM
    • Member
      7 point Member
    • momer123
    • Member since 10-29-2008, 1:14 PM
    • Posts 84

    Hi Thanks alot for your help. i will try it.

    One last question here, do you know if the end user can design crystal report at runtime? Create and design report from scratch on web?

    We want to give option to end user to design report on web.

     

  • Re: crystal report parameters on post back event

    07-03-2009, 10:34 AM
    Answer
    • Contributor
      2,624 point Contributor
    • CoolBond
    • Member since 10-25-2007, 1:34 PM
    • Country
    • Posts 518

     Hi,

    Why cant we use ExportToHttpResponse method of crystal report to render the report in pdf format which does not require the disk cleanup or whatever issues

    crReportDocument.ExportToHttpResponse(

     ExportFormatType.PortableDocFormat, this.Response, false, "some file name");

    If any issues in this, please correct me.

     

    Hope this will help you....

    " If people criticize you, hurt you, or shout at you,Don't be bothered. Just remember, In every game, audience make the noise, not the players "
  • Re: crystal report parameters on post back event

    07-03-2009, 10:54 AM
    • Member
      7 point Member
    • momer123
    • Member since 10-29-2008, 1:14 PM
    • Posts 84

    CoolBond:

     Hi,

    Why cant we use ExportToHttpResponse method of crystal report to render the report in pdf format which does not require the disk cleanup or whatever issues

    crReportDocument.ExportToHttpResponse(

     ExportFormatType.PortableDocFormat, this.Response, false, "some file name");

    If any issues in this, please correct me.

     

     

     

     

    Yes it is good idea i am going to try it.

    My previous question is not related to that one its different question. I am wondering if end user can design crystal report at run time.

     

  • Re: crystal report parameters on post back event

    07-03-2009, 12:21 PM
    Answer

    momer123:
    do you know if the end user can design crystal report at runtime?

    AFAIK, crystal report reuires design time template to load data on rumtime when you load it. So, designing from scratch on rumtime would not be possible.

    Aternatively, you can try for HTML reports or LogiXML


    hope it helps./.

    नमस्ते,
    [KaushaL] || BloG || MS MVP

    "I would love to change the world, but they won’t give me the source code"


    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers.
Page 1 of 1 (11 items)