samirpat

Name:
Location: Mumbai, India

Friday, May 19, 2006

Crystal Reports Not Showing Images On Net

Have u ever wondered y ur crystal reports in asp.net application which displays images properly in developer computer and not on the Production Web Server.

The reason being though u install the web application through the set up wizards by installing the Keycode License there is one particular setting that is not being done by the installer it has to be done manually.

This is the registry entries that u have to do.

this entry is in
"HKEY_LOCAL_MACHINE"
"SYSTEM"
"CURRENTCONTROLSET"
"SERVICES"
"W3SVC"
"PARAMETERS"
"VIRTUAL ROOTS"

Actually whenever Crystal reports uses images in the Reports they are created in a particular folder which is then mpped as a virtual directory on the IIS. it then references this folder as a URL.

there are two keys that are needed in this Keys.

1.) "/Crystal_license" = C:\Program Files\Seagate Software\Shared\Design Time Control\ASP,,1 this is the asp pages that are used by crystal reports.

2.) "/CrystalReportWebFormViewer" = C:\Program Files\Microsoft Visual Studio .NET\Crystal Reports\Viewers\,,201
this is the reference to the actual component which renders the images at runtime.


Happy Coding.
:-)

System.Runtime.Reflection

Here's a way to access the Objects that are added to ur current form without actually going through loop of the control list.

Normally one will loop through the Controls Collection and look for a particular control this is very efficient if you have very less no of controls, imagine a form having many controls and you need to change the properties of the controls dynamically doing this by looping will slow down the application.

The other way is to use Hashtable instead, HashTable is nothing but a collection of the References of the objects.
Example:
C#
using System.Collection;
using System.Refelection;

HashTable tmpHashTable=new Hashtable();
private void InitializaComponent()
{
//Here add all the controls to the HashTable.
tmpHashTable.Add(Control.Name, Control);
}

Then u can directly refere to the Object i.e get the reference of a particular object by just passing the name of the control.

Control tmpControl=(Control)tmpHashTable[Name of the Control];

Note: Hash Table Contains Only Reference of the Object and not the actual object.
so to use the properties u have to type cast the object to control.