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

Accesing report elements from a aspx.cs page

2 Answers 62 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Yash
Top achievements
Rank 1
Yash asked on 05 Apr 2011, 10:33 PM
When I can set the datasource property for a report from a .aspx.cs page, can't I set or get report elements from the aspx.cs page using the report object. If so, how can I do it?

This is what I did, but was unsuccessful. Made all report elements public.
Created an instance of the report object.
and I am trying to set the image of a picturebox through this instance. But couldnt do it. Why? is it possible to do it? if so how?

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 08 Apr 2011, 03:01 PM
Hi Yash,

In the following code snippet I have illustrated how to access a PictureBox item and set its value from the web form's code behind:

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        ProductSales report1 = new ProductSales();
        Telerik.Reporting.PictureBox pictureBox = (Telerik.Reporting.PictureBox)report1.Items.Find("pictureBoxLogo", true)[0];
        pictureBox.Value = @"C:\Chrysanthemum.jpg";
        this.ReportViewer1.Report = report1;
    }
}

Regards,
Peter
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Yash
Top achievements
Rank 1
answered on 08 Apr 2011, 06:26 PM
I did that. Thanks for the reply though
Tags
General Discussions
Asked by
Yash
Top achievements
Rank 1
Answers by
Peter
Telerik team
Yash
Top achievements
Rank 1
Share this question
or