Hi everybody,I'm using an instance of UltraWebGridExcelExporter to export an UltraWebGrid which is created dynamically. I don't setting up UltraWebGrid.DataSource, just adding Rows and Cells using C#. But everytime I try to use UltraWebGridExcelExporter the following error occurs:
Object reference not set to an instance of an object.
Why? If I add a list to DataSource and using DataBind() everything works fine. But I only need to setup the format and adding some data to specified columns...
Thx!!!
Hi Angel Todorov,
Recently I got the same issue. So, I downloaded the attachment zip "WebSite124.zip" that you had provided to have a deeper look and I found that you have misunderstood the question a bit. Actually @tmieruch had said that
to export an UltraWebGrid which is created dynamically.
But I looked into the aspx file and found that UltraWebGrid is already present there.
Default.aspx
<igtblexp:UltraWebGridExcelExporter ID="UltraWebGridExcelExporter1" runat='server'> </igtblexp:UltraWebGridExcelExporter> <igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server"> </igtbl:UltraWebGrid>
So, it's not a dynamic UltraWebGrid and hence everything is working fine for you. Could you please try to create a dynamic UltraWebGrid, add some columns and rows to it and then try to export it. Hopefully, you will also get the same issue like we got.
Looking forward to your response.
Thanks!
Hey,
I've prepared a sample for you where everything works and the grid contents is created dynamically in code behind.
Could you take a look? I am not sure if you have anything specific that may be causing this issue.
(click the button and it will export to excel).
Thanks,
Angel