Unable to programatically reference subreport property (EnableExternalImages) from main report - reportviewer

I have what i think is a unique requirement not addressed in other questions. I've developed a local report in Microsoft report designer as an rdlc and am viewing it via the report viewer control. The report contains a subreport. The subreport renders images from external files. The problem is that i need to programmatically set the EnableExternalImages property of the subreport at run time. Without this, the subreport refuses to render ("Error: Subreport could not be shown" is the error message i get). I've set this property on the main/outer report programatically without issue using this statement:
Me.ReportViewer1.LocalReport.EnableExternalImages = True
However i need to do the same on the sub-report...so optimally, i would like to code something like this:
Me.ReportViewer1.LocalReport.Subreport1.EnableExternalImages = True.
Problem is, i don't see a property available that provides me direct access to the subreport's properties in this fashion. I've looked into using the SubreportProcessingEvent, however this event only exposes a limited number of properties of the sub-report (Reportparamaters, Datasources, ReportPath, etc..), but does not provide me with access to all of it's properties (e.g. EnableExternalImages property).
Thanks for any information...

Related

VBA Adding a User Defined Control to Userform at Runtime

So I've made the following control in Design Mode then added the control to a new page Custom in my toolbox.
Now, what would I use for the progID parameter in Controls.Add()? How do I look up this value? Controls.Add("Forms.Frame.1") adds a regular frame, not the desired custom control.
As far as I am aware, you do not generate a new progID with a custom control. Per the MSDN documentation for custom/modified controls:
Note: When you drag a control onto the Control Toolbox, you only transfer the advanced property values.
So only the properties are transferred; the actual control is still of the same type/s as the one you created it from. Further, it looks like this progID is "a unique system-wide string that the Windows operating system can use to identify your control's type." So unless you are up to coding your own control, it looks as though you're just passing properties to the custom toolbox controls you create there.
You'll have to just replicate the custom control each time you want to add it. Just create a sub with all the correct properties and call it. Not what you were looking for, but it'll get the job done.

Where does Windows Search look for file properties?

We've implemented a shell property handler for a custom file format, with some standard properties and some custom. When we browse our files in Explorer our properties display nicely, but when our files appear in search results they don't. It seems that Explorer isn't querying our property handler when it displays search results.
My question is this: When Explorer displays an item in search results, where does it look for the item's properties? Does it query the appropriate handler, or does it look somewhere in some kind of search cache?
If it queries the handler then I'll investigate why our handler isn't called. (Maybe it's a registration fault.) If it looks in a search cache then I'll investigate why our files aren't indexed properly.
A secondary question: Is the search results pane restricted to a limited subset of the standard properties? In other words, should we just give up trying to display interesting properties here?
Some observations:
Our file format is just .msg (Outlook email message) renamed to .msga. Our handler knows how to read the .msg file format.
Property values display correctly in Browse mode.
They don't display in Search mode.
Property values are displayed correctly in Explorer's details pane, in either mode.
Some standard properties display OK in the search results, but not others, and no custom properties do. For example, these all display OK but are not served by our handler: System.ItemName, System.ItemUrl, System.Size, System.DateCreated. These are available in our handler but do not display: System.Title, System.Message.FromAddress, System.Message.DateSent.
Explorer is clearly reading our HKCR\<progid> registry key, because the display adapts as we edit ContentViewModeForSearch etc.
Our .msga file type is listed in Control Panel as an indexed file type, and our files are in an indexed directory. And I rebuilt the entire index this morning.
We haven't implemented a filter. Control Panel says that it's using "Office Outlook MSG IFilter" for .msga. (I don't know how it figured this out - maybe I copied a registry setting early in the project, or maybe Windows inferred it because we use Outlook for preview.)
Our handler implements IPropertyStore but its methods seem never to be called. (We've implemented some logging, to a file that the search indexer should have access to, but we can't be sure about that.)
Event Viewer shows gatherer error 3036 during indexing: "The content source <csc://{S-1-5-21-2153095834-1917727522-598830505-500}/> cannot be accessed." I think that SID is my user account, and so I wonder whether it's trying to index something to which it doesn't have privileges.

One or more data sources is missing credentials

I am implementing a series of rdlc reports on a webpage using a ReportViewer. When the report is initially generated is works fine but when I try to change the page of the report the following error is displayed:
"One or more data sources is missing credentials"
I have checked that the Data Source of the Local report is set correctly and the fact that the first page of the report is correctly displayed is proof of this.
When I export the report to a PDF or any other format it correctly includes all the report pages.
I have also tried implementing the PageNavigation event but this error is thrown before the event is called.
Does any one have any incite into this issue and what solution there may be?
Ok I found the the problem. I had a setting AsyncRendering set to false in order enable the reportviewer to stretch to the full width of the page.
Unfortunately this causes a postback and the enitre page is reloaded and obviously the datasource is lost.
Unfortunate as I will now have to manage the width of the reportviewer manually and it does not look great.
Anyway solution is to ensure AsyncRendering = true.

How can a custom web part read the list item fields in a display/edit form?

I need to create a custom web part and programmatically attach to the display and edit forms of a list. The web part is meant to display some information (coming from another list) about the list item being displayed on the form.
I know how to add the web part to the list programmatically, but I'm having an issue trying to get the web part to read the list item being displayed on from. I know the SPForm object exposes its parent list but I cannot or don't know how to convert the form to an SPForm object. The parent of the web part is the web part manager and the parent of that is the HTML form object. But when I try convert that to an SPForm object it throws an error.
Also, even if I manage to get hold of the SPForm and its parent list, how can I get hold of the list item being displayed?
Please bear in mind that I need to avoid overwriting the default forms as it will significantly increase the development time.
Any help or idea is appreciated.
Regards

Displaying multiple Reports in a single report viewer

i want to know is it possible to bind my all crystal reports to a single reportviewer, somewhat in tabbed view or treevie. If tabbed then visible through navigation button.
If yes then how?
any help would be highly appreciated.
Amit Ranjan
Having reviewed the micrososft documentation, it seems you can not bind multiple reports to a viewer. As suggested here:
"Displaying a report using the CrystalReportViewer control
The CrystalReportViewer control displays only one report at a time. Which report is displayed by the control is determined by which report you bind to your code. To tell the control which report to display, you bind the ReportSource property of the control to a particular report. At runtime, the control loads the report that is bound to the ReportSource property and displays it. "
The diocumentation goes on to say you can only bind a report type to the report source.
So, basically you need to build the multi view yourself. In my mind this can be done in two ways.
Create a report viewer for each
report (maybe using a tab control)
Create a single viewer and display
different reports based on what the user
selects in your application. i.e.
I have done something simular in the past, but rather than using the report viewer, i used crystal to export the report to pdf and displayed those to the user.
I hope this is clearer. :-)
Could you not hold your reports in a hierarchical structure in memory , which relates to a visible tree view and displayed the relevant report one at a time as the users selects various nodes..
If you can't pass a colection of reports to your viewer. I would hold a list of reports in a Dictionary or some other kind of list , which has a report and an identifier for that report.
Then display a tree view which represents the reports structure you have, with each node holding the id of the report it represents, when the user selects the a TreeView node, you can look up you report from the dictionary and load it into the report viewer.
I hope that makes sense...