如何在带有报表查看器的面板上使用ajax模型弹出扩展器 [英] How to use ajax model popup extender with panel having report viewer in it

查看:62
本文介绍了如何在带有报表查看器的面板上使用ajax模型弹出扩展器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,....

我遇到了一个问题,我可以使用ajax模型弹出扩展器来弹出面板.在该面板中有一个报告查看器,问题是我可以将面板显示为弹出窗口,但是它没有显示报告面板..我为btnreport保留了一个断点,在该处我已经编写了显示报告的代码,但是在执行btnreport中的代码之前,它会显示弹出窗口.

我的代码是这样的...

Hello everybody,....

I stuck with an issue that i can popup the panel using ajax model pop up extender.. and there is a report viewer in that panel, problem is i can display a panel as popup, but it is not displaying a report which is in that panel.. i kept a break point for btnreport where i have written code to display report, but before executing the code in btnreport its displaying the popup.

my code is something like this...

<asp:Button ID="btnreport" runat="server" Text="Report" OnClick="btnreport_Click"
                    CssClass="button" />


<asp:Panel ID="pnlrept" runat="server" CssClass="modalPopup" Style="display: none;">
 <rsweb:ReportViewer ID="ReportViewer1" runat="server" ShowBackButton="true"> </rsweb:ReportViewer>
 <br />
<asp:Button ID="btnClose" runat="server" Text="Close" />
 </asp:Panel>
 <Murali:ModalPopupExtender ID="pnlrept_ModalPopupExtender" runat="server" DynamicServicePath="" Enabled="True" TargetControlID="btnreport" PopupControlID="pnlrept" CancelControlID="btnClose" DropShadow="True">
 </Murali:ModalPopupExtender>




按钮中的代码是..




and code in the button is..

protected void btnreport_Click(object sender, EventArgs e)
    {
        BLL bl = new BLL();
        DataSet ds = bl.GetTrainingRecords(txtEmpId.Text);
        DataTable dt = new DataTable();
        dt = ds.Tables[0];
        string reportPath = @"D:\HRPortal\Training\Report.rdlc";
        ReportDataSource rds = new ReportDataSource
                ("TrainingRecord_TRdt", dt);
        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(rds);
        ReportViewer1.LocalReport.ReportPath = reportPath;
        ReportViewer1.ZoomPercent = 100;
        ReportViewer1.LocalReport.Refresh();
    }


有什么可以帮助我的吗?...

预先感谢.


Can any help me please....

Thanks in advance.

推荐答案



通常,将在客户端单击指定为扩展程序的目标控件ID的按钮时执行将打开模式弹出窗口的脚本.

在这里,如果要在弹出窗口打开时显示报告,则可以将button click 函数中的代码放置在Page Load之类的其他位置,或者将在用户单击按钮之前发生的其他事件中.

尝试这样.

Hi,

Normally, the script which will open the modal popup executes on client click of the button specified as the Target Control ID for the extender.

Here if you want to show the report as when the popup opens, then you can place the code which is in button click function, in some other place like Page Load or some other event which will occur before the user clicks on the button.

try like this.

//Page Load event.
if(!IsPostBack)
{
    BLL bl = new BLL();
    DataSet ds = bl.GetTrainingRecords(txtEmpId.Text);
    DataTable dt = new DataTable();
    dt = ds.Tables[0];
    string reportPath = @"D:\HRPortal\Training\Report.rdlc";
    ReportDataSource rds = new ReportDataSource
            ("TrainingRecord_TRdt", dt);
    ReportViewer1.LocalReport.DataSources.Clear();
    ReportViewer1.LocalReport.DataSources.Add(rds);
    ReportViewer1.LocalReport.ReportPath = reportPath;
    ReportViewer1.ZoomPercent = 100;
    ReportViewer1.LocalReport.Refresh();
}


并删除按钮的回发和onclick事件.

希望它能起作用.


and remove the post back and onclick event for button.

Hope it works.


这篇关于如何在带有报表查看器的面板上使用ajax模型弹出扩展器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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