Monday, March 12, 2012

Programming report viewer at run time

I have a report that works. It has been added to a webform (dot net 2.0)
that works. It has an image control in the upper left hand of the page
header. I would like to be able to change that graphic depending on a sql
table setting as the web form loads,
Does anyone know of a good detailed example of how to do this?
I have tried this and it does NOT work:
Dim myImage1 As New Image
myImage1 = Me.ReportViewer1.FindControl("Image1")
myImage1.ImageUrl = "Images/small_info_logo.jpg"
Thanks
ChuckOn Apr 20, 9:58 pm, ChuckT <Chu...@.discussions.microsoft.com> wrote:
> I have a report that works. It has been added to a webform (dot net 2.0)
> that works. It has an image control in the upper left hand of the page
> header. I would like to be able to change that graphic depending on a sql
> table setting as the web form loads,
> Does anyone know of a good detailed example of how to do this?
> I have tried this and it does NOT work:
> Dim myImage1 As New Image
> myImage1 = Me.ReportViewer1.FindControl("Image1")
> myImage1.ImageUrl = "Images/small_info_logo.jpg"
> Thanks
> Chuck
Instead of setting the ImageUrl in the web form, set it in the report
itself. You should be able to provide an Expression value for the
ImageUrl in the report builder - just point it to a dataset (possibly
using the Iif() function if the url is not stored in the database
records).
- Tokes|||Great idea, thank you very much. Plus it is a simplier implementation
Chuck
"Tokes" wrote:
> On Apr 20, 9:58 pm, ChuckT <Chu...@.discussions.microsoft.com> wrote:
> > I have a report that works. It has been added to a webform (dot net 2.0)
> > that works. It has an image control in the upper left hand of the page
> > header. I would like to be able to change that graphic depending on a sql
> > table setting as the web form loads,
> >
> > Does anyone know of a good detailed example of how to do this?
> >
> > I have tried this and it does NOT work:
> > Dim myImage1 As New Image
> > myImage1 = Me.ReportViewer1.FindControl("Image1")
> > myImage1.ImageUrl = "Images/small_info_logo.jpg"
> >
> > Thanks
> >
> > Chuck
> Instead of setting the ImageUrl in the web form, set it in the report
> itself. You should be able to provide an Expression value for the
> ImageUrl in the report builder - just point it to a dataset (possibly
> using the Iif() function if the url is not stored in the database
> records).
> - Tokes
>|||Actually that will not work. If you use any external pointer the designer
imports the garphic at design time. I am hoping to get a run time interrface
that loads the graphic based on a table value.
"ChuckT" wrote:
> Great idea, thank you very much. Plus it is a simplier implementation
> Chuck
> "Tokes" wrote:
> > On Apr 20, 9:58 pm, ChuckT <Chu...@.discussions.microsoft.com> wrote:
> > > I have a report that works. It has been added to a webform (dot net 2.0)
> > > that works. It has an image control in the upper left hand of the page
> > > header. I would like to be able to change that graphic depending on a sql
> > > table setting as the web form loads,
> > >
> > > Does anyone know of a good detailed example of how to do this?
> > >
> > > I have tried this and it does NOT work:
> > > Dim myImage1 As New Image
> > > myImage1 = Me.ReportViewer1.FindControl("Image1")
> > > myImage1.ImageUrl = "Images/small_info_logo.jpg"
> > >
> > > Thanks
> > >
> > > Chuck
> >
> > Instead of setting the ImageUrl in the web form, set it in the report
> > itself. You should be able to provide an Expression value for the
> > ImageUrl in the report builder - just point it to a dataset (possibly
> > using the Iif() function if the url is not stored in the database
> > records).
> >
> > - Tokes
> >
> >|||On Apr 21, 11:12 am, ChuckT <Chu...@.discussions.microsoft.com> wrote:
> Actually that will not work. If you use any external pointer the designer
> imports the garphic at design time. I am hoping to get a run time interrface
> that loads the graphic based on a table value.
That shouldn't be the case if you're setting the Url to an
expression... also check that the image control is not set to
'embedded'?
- Tokes
> "ChuckT" wrote:
> > Great idea, thank you very much. Plus it is a simplier implementation
> > Chuck
> > "Tokes" wrote:
> > > On Apr 20, 9:58 pm, ChuckT <Chu...@.discussions.microsoft.com> wrote:
> > > > I have a report that works. It has been added to a webform (dot net 2.0)
> > > > that works. It has an image control in the upper left hand of the page
> > > > header. I would like to be able to change that graphic depending on a sql
> > > > table setting as the web form loads,
> > > > Does anyone know of a good detailed example of how to do this?
> > > > I have tried this and it does NOT work:
> > > > Dim myImage1 As New Image
> > > > myImage1 = Me.ReportViewer1.FindControl("Image1")
> > > > myImage1.ImageUrl = "Images/small_info_logo.jpg"
> > > > Thanks
> > > > Chuck
> > > Instead of setting the ImageUrl in the web form, set it in the report
> > > itself. You should be able to provide an Expression value for the
> > > ImageUrl in the report builder - just point it to a dataset (possibly
> > > using the Iif() function if the url is not stored in the database
> > > records).
> > > - Tokes

No comments:

Post a Comment