Crystal Report工具栏ASP.Net中的问题 [英] Problem in Crystal Report toolbar ASP.Net

查看:74
本文介绍了Crystal Report工具栏ASP.Net中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,



我在asp.net 3.5应用程序中使用水晶报告。

问题是,无论何时任何一个单击工具栏按钮第一次它甚至没有响应,即使页面被回发,并在第二次点击它工作正常。我已将代码放在 Page_Init 事件绑定报告。



期待您的帮助。

提前致谢!!!



Supriya Srivastava





代码在这里:



Dear All,

I am using crystal report in asp.net 3.5 Application.
The problem is that whenever any of the toolbar buttons is clicked first time it doesn't respond even the page is postbacked,and on second click onwards it works fine.I have put the code in Page_Init event to bind report.

looking forward for your kind help.
Thanks in advance!!!

Supriya Srivastava


Code is Here:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;  
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.CrystalReports; 


public partial class Employee_Reports_Forms_frmPrnt_attendance_Summary : System.Web.UI.Page
{
    Common cmnsql = new Common();
    ReportDocument RptDoc;
    DataDefinition df;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["RptDoc"] = null;
            RptDoc = null;
            if (Request.QueryString["Title"] != null)
            {
                hid_RprtTitle.Value = Convert.ToString(Request.QueryString["Title"]);
            }
            hid_unm.Value = Convert.ToString(Session["UName"]);
            hid_RprtName.Value = Convert.ToString(Session["Report_Name"]);
            hid_CompCode.Value = Convert.ToString(Session["Comp_Code"]);
            hid_MonYr.Value = Convert.ToString(Session["MonYr"]);
            if (Session["Val"] != null)
            {
                hid_Val.Value = Convert.ToString(Session["Val"]);
            }
            else
            {
                hid_Val.Value = "";
            }
            LoadReport();
        }
    }
   
    private void LoadReport()
    {
        try
        {
            string Rprt_Name = "~\\FAS_Reports\\" + hid_RprtName.Value;
            DataTable dtattend = (DataTable)Session["dtattend"];
            RptDoc = new ReportDocument();
            RptDoc.Load(Server.MapPath(Rprt_Name));
            RptDoc.SetDataSource(dtattend);
            df = RptDoc.DataDefinition;
            RptDoc.Load(Server.MapPath(Rprt_Name));
            CrystalReportViewer1.ReportSource = RptDoc;
            CrystalReportViewer1.ID = "DownloadedReport";
            Session["RptDoc"]= RptDoc;
        }
        catch (Exception)
        {
            return;
        }
    }
    private void Page_Init(object sender, EventArgs e)
    {
        
            if (Session["RptDoc"] != null)
            {
                CrystalReportViewer1.ReportSource = (ReportDocument)Session["RptDoc"];
                CrystalReportViewer1.DataBind();
            }
    }
}

推荐答案

移动 Page_Load() 代码 Page_Init()



试试这个链接

Crystal Report查看器导航按钮无效 [ ^ ](阅读 sheikhusmanshakeel 的回复,其中包含代码)
Move your Page_Load() code to Page_Init()

Try this link
Crystal Report viewer navigation buttons not working[^](Read sheikhusmanshakeel's reply which has code)


这篇关于Crystal Report工具栏ASP.Net中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆