How to add button to crystal reports viewer toolbar

Hello,

I am struggling with how to add a new custom button to the Crystal Reports XI R2 viewer toolbar alongside the existing buttons (zoom, refresh, print, etc). The code I see that closest relates to this is viewDHTMLReport.jsp in my environment, but within this page there are just options to disable the existing buttons - not the actual “construction” of the page where I could code in a reference to a new button image, etc(if that makes any sense).

Can anyone point me in the right direction? Any help appreciated…

Thanks…


crystal01 :us: (BOB member since 2006-08-30)

So I stumbled into some sample code for adding a button to the toolbar that could be modified, but I really am not sure where to plug this in within the code. The closest place I can come up with in my environment is viewDHTMLReport.jsp. Ideas?

protected void Page_Init(object sender, EventArgs e)
{
    customizeToolbar();
}

private void customizeToolbar()
{
    Control ts = CrystalreportViewer1.Controls[2];
    if (ts.ToString().Contains("ViewerToolbar"))
    {
        ImageButton BtnExport = new ImageButton();
        BtnExport.ID = "BtnExport";
        BtnExport.ImageUrl = "images/pdf.png";
        BtnExport.ToolTip = "Export to ...";
        BtnExport.Click += BtnExport_Click;
        ts.Controls.Add(BtnExport);
    }
}

protected void BtnExport_Click(object sender, ImageClickEventArgs e)
{
    ...
}

crystal01 :us: (BOB member since 2006-08-30)

Did you ever solve this…?

I have a similar question…


MJRBIM :canada: (BOB member since 2007-03-23)