简体   繁体   中英

How to update a field in page header from group value in rdlc?

I am creating an rdlc report which shows sales data, please have a look at the this image ( http://i.stack.imgur.com/B3WQV.jpg ). The report shows a single invoice/bill containing multiple products of two different categories (say category1 and category2).

The report should print a separate page for each category ie if there are one or more products from category1 and one or more products from category2 in the same invoice, then there will be two pages printed (each page showing products from one category only). I have done this already by setting the Page Break to On from Group properties.

Now the problem i am facing is that i want to show a different logo for each category. I have placed an Image field in the page header and set its source property to "External" and used the following expression

=IIF(Instr(Fields!Category.Value,"category1")>0,"logo1.jpg","logo2.jpg")

But the logo image doesn't update from category (I see logo1.jpg for both categories). Please help

To start - you can access only one report item (from the report body, data bound) from the report header or footer. So, the goal would be to add some invisible container in the report body (probably in your table) that would contain your report logo path. Remember to set EnableExternalImages property of the report to true. When you do that, all you need to do is to set image Source property to "External" and value property to:

= ReportItems!textBoxContainingPathName.Value

Another way, and I think it's a better solution, is to get away from using the report header altogether and place it in the table header (the same one from the report body). Just add few more header rows above you existing header rows to fit logo and your header values. In this case you can manipulate your header content freely as it is "aware" of the current value of source dataset.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM