Hi all,
I'm working with Crystal Reports 8.0, the version that shipped with the original release of Visual Studio .NET. I manipulate the report through code on the server to customize it based on the user. I have a report with a text object in the PageHeader section. I need to change the text of the text object through code on the server to reflect the user accessing the report. The C# code I have is this:
Well, this code won't compile, and the error I get is that that "rpt does not contain a definition for PageHeader". This, of course, is ridiculous, as Crystal Reports objects do have a property called PageHeader.
As you know, when you create a Crystal Reports, a *.cs (if you're working with C#) file is created along with it. This file contains a class which represents the report created. Given this, I went to the *.cs to check what was going on and I notieced that, indeed, there was no definition for PageHeader. Instead the class contained a definition for Section2, which is the report section that represents the PageHeader is.
Well, I manually changed "Section2" in the *.cs and named it "PageHeader" and now the code now works with no problem. However, about 50 times a day, when I'm editing the report, the "PageHeader" property is changed back to "Section2" and the code stops compiling until I change it back again to "PageHeader". It is very, very, very annoying... By the way, I have another report, which I created previously, and I don't have this problem. The "PageHeader" property is always there.
Can anybody please tell me what I can do so that the "PageHeader" property doesn't get changed back to "Section2" all the time?
Thanks
JC
We don't see things as they are; we see them as we are. - Anais Nin
I'm working with Crystal Reports 8.0, the version that shipped with the original release of Visual Studio .NET. I manipulate the report through code on the server to customize it based on the user. I have a report with a text object in the PageHeader section. I need to change the text of the text object through code on the server to reflect the user accessing the report. The C# code I have is this:
Code:
myCrystalReport rpt = [COLOR=blue]new[/color] myCrystalReport();
...
rpt.[b]PageHeader[/b].ReportObjects["myTextObject"].Text = "clientText";
...
As you know, when you create a Crystal Reports, a *.cs (if you're working with C#) file is created along with it. This file contains a class which represents the report created. Given this, I went to the *.cs to check what was going on and I notieced that, indeed, there was no definition for PageHeader. Instead the class contained a definition for Section2, which is the report section that represents the PageHeader is.
Well, I manually changed "Section2" in the *.cs and named it "PageHeader" and now the code now works with no problem. However, about 50 times a day, when I'm editing the report, the "PageHeader" property is changed back to "Section2" and the code stops compiling until I change it back again to "PageHeader". It is very, very, very annoying... By the way, I have another report, which I created previously, and I don't have this problem. The "PageHeader" property is always there.
Can anybody please tell me what I can do so that the "PageHeader" property doesn't get changed back to "Section2" all the time?
Thanks
JC
We don't see things as they are; we see them as we are. - Anais Nin