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

Set image position from database field

8 Answers 262 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Wayne
Top achievements
Rank 1
Wayne asked on 28 Mar 2012, 11:30 AM
Hi,
I bind an image to a Uri read from the DB. I need to be able to set the position along the x axis from an int value read from the DB. How can I set the position?
Thanks.
Wayne

8 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 28 Mar 2012, 11:58 AM
Hi Wayne,

Check the following forum thread for more info on your inquiry: Field position from database.

Kind regards,
Steve
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
Wayne
Top achievements
Rank 1
answered on 28 Mar 2012, 02:11 PM
Hi Steve,
thanks but I have tryed this but get the following error:

= location(Fields.LogoPosition) cannot be parsed as a unit because it does not contain numeric values. examples of valid unit strings are 1pt and .5in.
It is a PictureBox I am trying to set the position on.
Thangs again

Wayne
0
Hadib Ahmabi
Top achievements
Rank 1
answered on 29 Mar 2012, 11:28 AM
This "location" should be a user function that returns Telerik.Reporting.Drawing.Unit. And it should take 1 parameter of type typeof(LogoPosition). 
0
Wayne
Top achievements
Rank 1
answered on 29 Mar 2012, 12:58 PM
thanks again, I now have some invalid arguments in the return statement! My function is as below.

public

 

 

static Telerik.Reporting.Drawing.Unit location(double pos)

{

return new Telerik.Reporting.Drawing.Unit(new Telerik.Reporting.Drawing.Unit(pos, Telerik.Reporting.Drawing.UnitType.Cm),
new Telerik.Reporting.Drawing.Unit(pos, Telerik.Reporting.Drawing.UnitType.Cm));

}


Thanks again for the help

Kind regards
Wayne
0
Hadib Ahmabi
Top achievements
Rank 1
answered on 29 Mar 2012, 02:32 PM
Sorry, I have mislead you. The function should return Telerik.Reporting.Drawing.PointU.
0
Wayne
Top achievements
Rank 1
answered on 29 Mar 2012, 02:56 PM
Hi again,
I've change the function to the following:

public static Telerik.Reporting.Drawing.PointU location(double pos)
{

return new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(pos, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(pos, Telerik.Reporting.Drawing.UnitType.Cm));

}

but I now get the same error as in post from yesterday:
 = location(Fields.LogoPosition) cannot be parsed as a unit because it does not contain numeric values. examples of valid unit strings are 1pt and .5in.

I try to call the method from the Location property of the PictureBox.
Can you let me know why it is still not working.

Thanks again
Kind regards

Wayne
0
Accepted
Hadib Ahmabi
Top achievements
Rank 1
answered on 29 Mar 2012, 03:54 PM
Where are you using this expression? I have a feeling that you are trying to set it directly to the Location property. If that is the case, you should use Bindings to bind the Location property, not directly assign this expression string to it. 
See: http://www.telerik.com/help/reporting/expressions-bindings.html 
0
Wayne
Top achievements
Rank 1
answered on 30 Mar 2012, 08:29 AM
Thanks for the help, it works fine now.

Kind regards
Wayne
Tags
General Discussions
Asked by
Wayne
Top achievements
Rank 1
Answers by
Steve
Telerik team
Wayne
Top achievements
Rank 1
Hadib Ahmabi
Top achievements
Rank 1
Share this question
or