Showing posts with label assembly. Show all posts
Showing posts with label assembly. Show all posts

Tuesday, March 27, 2012

Change image properties at runtime

Hi,
I'm using Reporting Services for SQL2K. My report will need to dynamically
call a custom assembly for each row in a dataset, and then show the image
file that the custom assembly creates. I was thinking of using an Image
control in the report and then changing the path to the image file at
runtime. But I can not figure out how to access the image1.Value property.
Any tips on this or perhaps an alternative solution?
TIA
JonasI found the answer, and it was very easy ;-)
When the control is selected in the Report Designer, it it possible to edit
the properties as usual. The property for Value can also use an Expression,
and voila, this can point to a variable which contains a dynamically created
path.
Brgds
Jonas
"Jonas" <Jonas@.nospam.pl> wrote in message
news:%23z53z3cHGHA.240@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I'm using Reporting Services for SQL2K. My report will need to dynamically
> call a custom assembly for each row in a dataset, and then show the image
> file that the custom assembly creates. I was thinking of using an Image
> control in the report and then changing the path to the image file at
> runtime. But I can not figure out how to access the image1.Value property.
> Any tips on this or perhaps an alternative solution?
> TIA
> Jonas
>
>

Sunday, February 12, 2012

Casting

Hello,
I created a custom assembly with some business logic and attachted it to a
report.
A class in the assemby has an indexer defined which should return a string.
When I call the indexer from the code block I alway get an "Specified cast is
not valid" error back.
I created a test program in VS to test the classes and the indexer there
everything works fine.
What am I missing?
QSolved it.
I called a method on my class like the following:
wga.Attributes.Add("BG_CODE", Report.Parameters("Conc_BG").Value)
The definition for the Add method is:
public void Add(string databaseColumnName, string value)
But I have also another Add method which is:
public void Add(object key, object value)
I have to implement this method because my class inherits from IDictionary
I was under the impression that when I am adding strings the method with the
strings signature would be taken. But this was not the case. Instead the Add
method with the object signature was taken. Therefore my collection was
filled with objects and the indexer expected strings.
To solve this I had to rewrite it like the following:
wga.Attributes.Add("BG_CODE".ToString,
Report.Parameters("Conc_BG").Value.ToString)
Now the Add method with the strings signature is called.
Long live VS debugging!
Q
"Qbee" wrote:
> Hello,
> I created a custom assembly with some business logic and attachted it to a
> report.
> A class in the assemby has an indexer defined which should return a string.
> When I call the indexer from the code block I alway get an "Specified cast is
> not valid" error back.
> I created a test program in VS to test the classes and the indexer there
> everything works fine.
> What am I missing?
> Q