This is a migrated thread and some comments may be shown as answers.

Change Picturebox Value from XmlReportSource at runtime

2 Answers 19 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joao
Top achievements
Rank 1
Joao asked on 08 May 2017, 06:58 PM

Hi,

I need to modify, when loading, a picturebox value from a report generated in TRDX and kept in a DB.

I know that's maybe because my knowlage is limitated... but after several tries and too many hours searching I can't find the correct way. Anyone can help??

I'm develloping in asp.net webforms, c#, VS2013.

Here'a a code snippet of my question:

 

XmlReportSource mapa = new XmlReportSource();
string xml = dal.LeMapa(connection, Session["Report"].ToString());
mapa.Xml = xml.Replace("DBDev",connection);
mapa.Parameters.Add("Sigla", Session["Sigla"].ToString());
ReportViewer.ReportSource = mapa;

XmlReportSource instanceReportSource = (XmlReportSource)this.ReportViewer.ReportSource;
Report report = (Report)instanceReportSource.ToString();
PictureBox img = report.Items.Find("logo", true)[0] as PictureBox;
DataTable dt = dal.LeLogoEmpresa(Connection);
if (dt.Rows.Count > 0)
    foreach (DataRow dr in dt.Rows)
    {
        img.Value = dr["Logotipo"];
        img.MimeType = dr["ImgTip"].ToString();
        break;
}

How canI find the picturebox??

Thanks.

2 Answers, 1 is accepted

Sort by
0
Joao
Top achievements
Rank 1
answered on 10 May 2017, 03:31 AM

It's more easy to modify the report markup before linking it as a reportsource. It's done!

Thanks anyway.

0
Stef
Telerik team
answered on 10 May 2017, 01:03 PM
Hi Joao,

Modifying the XML is valid approach, where you will have to check if the XML structure is the same on upgrade.
The recommended approach is to use an expression as PictureBox.Value.

I hope this helps.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Joao
Top achievements
Rank 1
Answers by
Joao
Top achievements
Rank 1
Stef
Telerik team
Share this question
or