Hi,
when i am exporting the data to PDF. The pdf is showing as blank.
Here is my code:
UltraGrid1.DataSource = table;
ultraGridDocumentExporter1.Export(this.UltraGrid1,"grid1.pdf",GridExportFileFormat.PDF);
Please give the solution. Deadline is coming for code submission.
Thanks & Regards,
Suman George
I'm afraid I can't guess why it's not working just from these two lines of code. Are you sure the grid has any data in it? Does the data in the grid display on the screen? Did you try checking the grid.Rows.Count?
hi mike,
thanx for responding.
I checked the grid has the data. i also checked t count it's coming perfectly.
Well, if the grid has data and the export is blank, then either that's a bug in the version of the controls you are using or there's something else going on in your application that you haven't told me about.
Can you post a small sample project demonstrating this behavior so we can check it out?
an update here.
When i checked thoroughly i came to notice that when i do
the datasource is having the data but when i looked closely for the UltraGrid1.Count it is coming 0.
This is driving me crazy really can't guess why this is happening.
Regards,
Hi Suman,
Are you seeing the grid data on the screen? Or is the grid not visible on-screen?
My guess is that you are creating the grid control in code and it's not visible and has no container, so it has no BindingContext and cannot get the data. You need to add the grid to the form so it has a BindingContext.
Thanks mike,
I got the solution. The Binding Context was the key.
The grid (or any bound control) needs a BindingContext in order to retrieve the bound data. It usually gets this from the container (the form). So if you simply add the grid to the form, it should fix it:
this.Controls.Add(grid);
If you have no form, then another option would just be to create a new BindingContext:
grid.BindingContext = new BindingContext();
mike,
yes you are right at this point. I am creating the grid in the code as don't need the grid in form.
Could you please guide as how to create a grid in the code itself which will not be visible in the screen.