This is a migrated thread and some comments may be shown as answers.

[Solved] Problem in Hierarchical Grid Export to excel

7 Answers 179 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Computer Surgeon
Top achievements
Rank 1
Computer Surgeon asked on 29 Jun 2009, 12:16 PM
Hi there,
I m using telerik 2008.02.0826.20 version. While exporting my RadGrid to Excel Cannot find a cell bound to column name 'InvoiceId'
<MasterTableView Width="100%" Name="Master" HierarchyLoadMode="ServerBind" DataKeyNames="InvoiceId" 
HorizontalAlign="NotSet" CommandItemDisplay="Top"
<DetailTables> 
<telerik:GridTableView Name="Detail" BackColor="White" AllowNaturalSort="true" runat="server" 
DataKeyNames="invoiceidfkid" Width="100%"
<ParentTableRelation> 
<telerik:GridRelationFields MasterKeyField="InvoiceId" DetailKeyField="invoiceidfkid"
</telerik:GridRelationFields> 
</ParentTableRelation> 
Master Detail table relation is given above.
in code behind the following code is given.
rgInvoice.MasterTableView.HierarchyDefaultExpanded = true;
rgInvoice.ExportSettings.ExportOnlyData = true;
rgInvoice.ExportSettings.IgnorePaging = true;
rgInvoice.ExportSettings.OpenInNewWindow = true;
Normal hierarchical functionality is working fine as usual , But while clicking on Export To Excel i get a ERROR message : Cannot find a cell bound to column name 'InvoiceId' . Please help me to get ride of this issue.

Thanks!

7 Answers, 1 is accepted

Sort by
0
Computer Surgeon
Top achievements
Rank 1
answered on 29 Jun 2009, 12:25 PM
 <telerik:RadGrid> 
 <MasterTableView Width="100%" Name="Master" HierarchyLoadMode="ServerBind" DataKeyNames="InvoiceId" 
HorizontalAlign="NotSet" CommandItemDisplay="Top"
 <DetailTables> 
<telerik:GridTableView Name="Detail" BackColor="White" AllowNaturalSort="true" runat="server" 
DataKeyNames="invoiceidfkid" Width="100%"
<ParentTableRelation> 
<telerik:GridRelationFields MasterKeyField="InvoiceId" DetailKeyField="invoiceidfkid"
</telerik:GridRelationFields> 
</ParentTableRelation> 
<Columns> 
 <telerik:GridBoundColumn HeaderText="invoiceidfkid" DataField="invoiceidfkid" Display="false" 
SortExpression="invoiceidfkid" UniqueName="invoiceidfkid"
</telerik:GridBoundColumn> 
</Columns> 
</telerik:GridTableView> 
</DetailTables> 
<Columns> 
<telerik:GridBoundColumn HeaderText="InvoiceId" Display="false" DataField="InvoiceId" SortExpression="InvoiceId" 
UniqueName="InvoiceId"
<ItemStyle Width="0%" /> 
<HeaderStyle ForeColor="Black" HorizontalAlign="Center" /> 
</telerik:GridBoundColumn> 
</MasterTableView> 
 </telerik:RadGrid> 

0
Daniel
Telerik team
answered on 29 Jun 2009, 12:42 PM
Hello,

This usually happens when you try to get a non-existing column (in code-behind) using the GetColumn server-side method. Could you please let me know whether this is your scenario?

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Computer Surgeon
Top achievements
Rank 1
answered on 29 Jun 2009, 12:47 PM
This Column Exists for sure. Because only on export to excel i get this Error message. Other than that Add,Edit,Delete Expand Collapse works fine . I guess that while executing "rgInvoice.MasterTableView.HierarchyDefaultExpanded = true;" in codebehind makes such error message .
0
Computer Surgeon
Top achievements
Rank 1
answered on 29 Jun 2009, 02:19 PM
This Error "Cannot find a cell bound to column name 'goalname' " arises only when i insert "grdGoals.MasterTableView.HierarchyDefaultExpanded = true;" this statement in codebehind on click of Export to Excel.
0
Princy
Top achievements
Rank 2
answered on 30 Jun 2009, 07:24 AM
Hi,

It seems you are trying to access columns in the mastertableview or detailtable without checking for the corresponding ownertableview.
When you access columns in a hierarchial grid, it is always advisable to differentiate between the mastertable and detailtable.
You can use the Name Property or DataSource property of the GridTableViews to differentiate between the tables. This is explained in the help link below:
Distinguish grid rows in hierarchy

Thanks
-Princy.



0
Computer Surgeon
Top achievements
Rank 1
answered on 01 Jul 2009, 06:52 AM
Hi there,

                Found one solution, But not permanent. By adding all the columns in MasterTableView to DetailTable and made that columns to Visible = "False". Now this "Cannot find a cell bound to column name 'InvoiceId' " ERROR is not occuring.
0
Daniel
Telerik team
answered on 02 Jul 2009, 07:34 PM
Hello,

I believe it would be best if you just send your project attached to a support ticket. We will examine it at our side and then provide an appropriate answer for you. Alternatively you could post your code-behind in this thread. In the meantime you can examine the test project that I used in my attempts to reproduce the issue.

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Computer Surgeon
Top achievements
Rank 1
Answers by
Computer Surgeon
Top achievements
Rank 1
Daniel
Telerik team
Princy
Top achievements
Rank 2
Share this question
or