|
VS 2005
C#
Crystal Reports
I created a gridview that returns the contents of the the 'reports' directory in my web project. It displays the *.rpt files as links. The links point to an aspx page that contains a <CR:CrystalReportViewer ID="crystalReportViewer" runat="server" />. I am trying to dynamically pass in the reportPath by doing something like this: (report path will change depending on the link that is clicked on)
string reportPath = Server.MapPath("Reports" + Eval("name"));' but when I do this I get an error that states:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. I am new to this and was wondering if somebody could give me an idea as to how I could get the report the corresponds to the link that I click on.
|
|
|
|
|
Try this:
string reportPath=Request.PhysicalApplicationPath + "Reports\\" + name );
where name is the .rpt filename.
|
|
|
|
|
Hi thanks for the response.
I tried what you recommended and it did not work. The 'name' is the file name which is in a directory called reports, I get the name from the code below. When I try to pass the name to the Report path it tells me I can do that.
DirectoryInfo di = new DirectoryInfo("C:/Inetpub/wwwroot/ITS_USA/Reports");
FileInfo[] rgFiles = di.GetFiles("*.rpt");
gvReportList.DataSource = rgFiles;
gvReportList.DataBind();
foreach (FileInfo fi in di.GetFiles("*.rpt"))
|
|
|
|
|
Do you receive any error ?
I think the code you use to full the grid is fine.
|
|
|
|
|
Yes, The name 'name' does not exist in the current context.
|
|
|
|
|
Ok I got it,
in this part:
string reportPath=Request.PhysicalApplicationPath + "Reports\\" + name );
You have to replace that with the variable where you have the .rpt file name, I suppose one value from the grid...
Si the result should be something like:
C:\Inetput\wwwroot\myapp\reports\report1.rpt
Where Report1.rpt is the value from your variable.
|
|
|
|
|
Yes that is what I am trying to do.
the variable name comes form the directory info. class. I then want to pass the 'name' of the file precededed by the folder 'reports'. So just like you mentioned it would dynamically create the report path. Hmph. Nothing is ever easy when your new.
modified on Tuesday, April 21, 2009 12:37 PM
|
|
|
|
|
Hello,
Does anybody know how to return $? and $LASTEXITCODE back to the C# caller after a script has been executed using Jean-Paul Mikkers async powershell code execution from c# article here on code project with the address below.
Asynchronously Execute PowerShell Scripts from C#[^]
regards
Bob.
|
|
|
|
|
Dear sir,
i want to control system sound using wpf slider control.
how can i do?? any idea??
yogesh
|
|
|
|
|
did you even try and google that, if you don't know how more info can be found here[^]
this might help either
clickety[^]
|
|
|
|
|
Dear sir,
i have searched in google but i didn't get anything . that is why i posted here.
yogesh
|
|
|
|
|
|
buachaill cliste wrote: did you even try and google that, if you don't know how more info can be found here[^]
Awesome. That's the best thing since www.lmgtfy.com[^]
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
I was going to do that but I kept getting a DNS error
But I can go everywhere else lol
Just when ya want it
|
|
|
|
|
Hi,
I have an instance of Bitmap that I want to save as an PNG with Indexed colour mode. How can I do this in .NET?
Thanks,
Steve
|
|
|
|
|
Don't know about indexed colour as I've never had the necessity to do it before and google might help
but this:
Bitmap bmp = new Bitmap(x,y);
bmp.Save("c:\\bmp", System.Drawing.Imaging.ImageFormat.Png);
|
|
|
|
|
That always saves as ARGB png as far as I know..
|
|
|
|
|
Oh ok. I didn't know
Just tryin' to help
|
|
|
|
|
Hi,
I don't think .NET supports indexed colors for PNG.
This MSDN page[^] says PNG needs 0 bytes for parameters, so there is nothing to choose from.
|
|
|
|
|
For anyone else who wants to achieve this, the FreeImage project provides support for a large number of image codecs and colour modes and has bindings for C#. It is what I used to create a PNG8 file.
Steve
|
|
|
|
|
I'm hoping someone can help me here ...
I have a project that is working well connecting to an Access database file, making queries etc. I discovered that one of the fields in the database is of the wrong type (it is Int32, i want it Text).
- I changed the field type in the database (via Designer View in Access)
- I changed the field type in DataSet in my project (DatabaseDataSet.xsd)
- I changed the data type in the .Add routine.
However, when I compile, the tableadapter .Update command complains about not being able to convert String to Int32. I can't find what else needs to be changed!
Any ideas please ?
Andy
|
|
|
|
|
God I hate MS adapters. Destroy the adapter and rebuild it on the changed table.
The problem with the adapters is the dev who knows nothing else has no idea how they work and therefore when something goes wrong gets stuck with nowhere to go. Recommendation - do some research into a decent Data Access Layer (DAL) there are lots of samples out there and if you are serious about being a dev you need to be able to build one! Sorry rant over.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I had this code working yesterday. Today I get "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Here's the code. It errors on the oSheet.SaveAs line:
Microsoft.Office.Interop.Excel.Application oXL;
Microsoft.Office.Interop.Excel._Workbook oWB;
Microsoft.Office.Interop.Excel._Worksheet oSheet;
oXL = new Microsoft.Office.Interop.Excel.Application();
oWB = (Microsoft.Office.Interop.Excel._Workbook)(oXL.Workbooks.Add(Missing.Value));
oSheet = (Microsoft.Office.Interop.Excel._Worksheet)oWB.ActiveSheet;
Reader = new StreamReader(ExportParams.sSourceFileName);
iRow = 0;
sSourceRow = Reader.ReadLine();
while (sSourceRow != null)
{
iRow++;
string[] aWords = sSourceRow.Split(',');
oSheet.Cells[iRow, 1] = aWords[0];
oSheet.Cells[iRow, 2] = aWords[1];
oSheet.Cells[iRow, 3] = aWords[2];
sSourceRow = Reader.ReadLine();
}
Reader.Close();
if (File.Exists(ExportParams.sResultFileName))
{
File.Delete(ExportParams.sResultFileName);
}
oSheet.SaveAs(ExportParams.sResultFileName,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing);
oXL.Quit();
Everything makes sense in someone's mind
|
|
|
|
|
Hi ,
can anyone tell how to find the system memory using c#.net 3.5 windows application?
Thanks In Advance.
--Naren
|
|
|
|
|