Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for OnReportError and OnPreRender #202

Open
SalvadorFloresMichel opened this issue Nov 21, 2024 · 1 comment
Open

Support for OnReportError and OnPreRender #202

SalvadorFloresMichel opened this issue Nov 21, 2024 · 1 comment

Comments

@SalvadorFloresMichel
Copy link

Need to change the default export options like:

protected void repViewer_PreRender(object sender, EventArgs e)
{
try
{
FieldInfo info;
foreach (RenderingExtension extension in repViewer.LocalReport.ListRenderingExtensions())
{
if ((fldExportPDF.Value == "0" && extension.Name.Trim().ToUpper() == "PDF")
|| (fldExportXLS.Value == "0" && extension.Name.Trim().ToUpper().StartsWith("EXCEL"))
|| (fldExportDoc.Value == "0" && extension.Name.Trim().ToUpper().StartsWith("WORD")))
{
info = extension.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic);
info.SetValue(extension, false);
}
}
}
catch (Exception err)
{ ShowError(err.Message); }
}

And i have an error for missing parameters, but the regular exception does not show the error detail

protected void repViewer_ReportError(object sender, ReportErrorEventArgs e)
{
string strMensaje = e.Exception.Message;
if (e.Exception.InnerException != null)
{ strMensaje += ". " + e.Exception.InnerException.Message; }
ShowError(strMensaje);
}

@lkosson
Copy link
Owner

lkosson commented Nov 22, 2024

You can change ReportViewer control settings in OnLoad method of your form and/or when you populate the datasource and parameters. As for error messages - those are (or at least should be) exactly the same as in original ReportViewer for compatibility reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants