<table align="center"> <tr> <td> <asp:LinkButton runat="server" ID ="lbtnShowInstalledPrinters" Text ="Show Installed Printers" OnClientClick="showInstalledPrinters()"></asp:LinkButton> <%--<input type="button" id="btnShowInstalledPrinters" value="Show Insalled Printers" önclick="showInstalledPrinters()" />--%> </td> </tr> <tr> <td align="center"> <rsweb:ReportViewer ID="rvReport" runat="server" Font-Names="Verdana" Font-Size="8pt" Height="100%" ShowRefreshButton="False" AsyncRendering ="False" SizeToReportContent="True" Visible="True" Width="100%" ZoomMode="PageWidth"> </rsweb:ReportViewer> </td> </tr> </table>
and this is my ascx.cs code #region Properties public DataTable MainDataSource { set { ViewState["MainDataSource"] = value; rvReport.Reset(); rvReport.LocalReport.DataSources.Clear(); rvReport.LocalReport.DataSources.Add(new ReportDataSource("Main", value)); } get { if (ViewState["MainDataSource"] != null) { return (DataTable) ViewState["MainDataSource"]; } return null; } } public DataTable HeaderDataSource { set { ViewState["HeaderDataSource"] = value; } get { if (ViewState["HeaderDataSource"] != null) { return (DataTable)ViewState["HeaderDataSource"]; } return null; } } public bool ShowInstalledPrinterBtn { set { lbtnShowInstalledPrinters.Visible = value; } get { return lbtnShowInstalledPrinters.Visible; } } public string rprtEmbeddedResource { set { ViewState["rprtEmbeddedResource"] = value; } get { if (ViewState["rprtEmbeddedResource"] != null) { return ViewState["rprtEmbeddedResource"].ToString(); } return null; } } #endregion Properties #region Page Events protected void Page_Load(object sender, EventArgs e) { rvReport.LocalReport.ReportPath = Server.MapPath("Reports/FUDSTDTranscriptRPT.rdlc"); } #endregion Page Events #region Methods public void RefreshReport() { rvReport.Reset(); rvReport.LocalReport.DataSources.Clear(); rvReport.LocalReport.ReportPath = Server.MapPath("Reports/FUDSTDTranscriptRPT.rdlc"); rvReport.LocalReport.DataSources.Add(new ReportDataSource("Main", MainDataSource)); rvReport.LocalReport.DataSources.Add(new ReportDataSource("HeaderDS", HeaderDataSource)); rvReport.Visible = (MainDataSource.Rows.Count != 0 && HeaderDataSource.Rows.Count!=0); rvReport.LocalReport.ReportEmbeddedResource = rprtEmbeddedResource; rvReport.LocalReport.Refresh(); } public void DisableUnwantedExportFormat(ReportViewer ReportViewerID, string strFormatName) { FieldInfo info; foreach (RenderingExtension extension in ReportViewerID.LocalReport.ListRenderingExtensions()) { if (extension.Name == strFormatName) { info = extension.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic); info.SetValue(extension, false); } } } #endregion Methods } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)