Charles Entlogic
Top achievements
Rank 1
Charles Entlogic
asked on 20 Aug 2009, 05:52 PM
Hi,
I'm very glad to point out that all solutions provided by you people are very much useful.
Now I'm facing another problem. In my project I want to download the data from grid to Excel sheet. My grid is a single level hirearchial grid. I'm hiding the child table from user if there is no record to display. But when we export the grid content to excel this child table is visible in excel sheet with content "No child recored to display". I don't want to show the 'child table with no data 'in excel sheet. How can I do this.
Thanks in advance...
I'm very glad to point out that all solutions provided by you people are very much useful.
Now I'm facing another problem. In my project I want to download the data from grid to Excel sheet. My grid is a single level hirearchial grid. I'm hiding the child table from user if there is no record to display. But when we export the grid content to excel this child table is visible in excel sheet with content "No child recored to display". I don't want to show the 'child table with no data 'in excel sheet. How can I do this.
Thanks in advance...
6 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 21 Aug 2009, 07:59 AM
Hi Charles,
Try hiding the the detail table if there are no records as shown below and see whether it helps.
CS:
Shinu
Try hiding the the detail table if there are no records as shown below and see whether it helps.
CS:
| protected void RadGrid1_PreRender(object sender, EventArgs e) |
| { |
| HideExpandColumnRecursive(RadGrid1.MasterTableView); |
| } |
| public void HideExpandColumnRecursive(GridTableView tableView) |
| { |
| GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView); |
| foreach (GridNestedViewItem nestedViewItem in nestedViewItems) |
| { |
| foreach (GridTableView nestedView in nestedViewItem.NestedTableViews) |
| { |
| if (nestedView.Items.Count == 0) |
| { |
| nestedViewItem.Visible = false; |
| } |
| if (nestedView.HasDetailTables) |
| { |
| HideExpandColumnRecursive(nestedView); |
| } |
| } |
| } |
| } |
Shinu
0
Hello Charles,
Please find attached a sample project demonstrating the required functionality.
If I missed something please let me know.
Regards,
Martin
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.
Please find attached a sample project demonstrating the required functionality.
If I missed something please let me know.
Regards,
Martin
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
Charles Entlogic
Top achievements
Rank 1
answered on 21 Aug 2009, 10:54 AM
Hi Shinu & Martin,
Shinu,
Thanks for your quick reply. I'm already using this function in Grid Prerender event for hiding the child table with no records and this will not make any change in the excel sheet when exporting. Hope you will give me a better solution.
Martin,
Thanks for yor reply. Your solution worked for some extend, now it hides all child record table whether it contain records or not. I want to hide only the 'child table with no records' being showing in excel.
Looking forward for your answer..
Shinu,
Thanks for your quick reply. I'm already using this function in Grid Prerender event for hiding the child table with no records and this will not make any change in the excel sheet when exporting. Hope you will give me a better solution.
Martin,
Thanks for yor reply. Your solution worked for some extend, now it hides all child record table whether it contain records or not. I want to hide only the 'child table with no records' being showing in excel.
Looking forward for your answer..
0
Hello Charles,
Please try the following:
Hope this helps.
Best regards,
Martin
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.
Please try the following:
| protected void RadGrid1_PreRender(object sender, EventArgs e) |
| { |
| GridItem[] nestedViewItems = RadGrid1.MasterTableView.GetItems(GridItemType.NestedView); |
| foreach (GridNestedViewItem nestedViewItem in nestedViewItems) |
| { |
| bool validItem = false; |
| foreach (GridTableView nestedView in nestedViewItem.NestedTableViews) |
| { |
| if (nestedView.Items.Count == 0) |
| { |
| nestedViewItem.NestedTableViews[Array.IndexOf(nestedViewItem.NestedTableViews, nestedView)].Visible = false; |
| } |
| else |
| { |
| validItem = true; |
| } |
| } |
| if (!validItem) |
| { |
| nestedViewItem.Visible = false; |
| } |
| } |
| } |
Hope this helps.
Best regards,
Martin
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
Charles Entlogic
Top achievements
Rank 1
answered on 27 Aug 2009, 10:02 AM
Hello Martin,
I'm very desperate to say that the solution provided by you didn't work. I'm already using this function in prerender event to hide the child table with no data. But it has no effect when exporting to excel property called. Please help me to resolve this issue.
Thanks...
I'm very desperate to say that the solution provided by you didn't work. I'm already using this function in prerender event to hide the child table with no data. But it has no effect when exporting to excel property called. Please help me to resolve this issue.
Thanks...
0
Hello Charles,
On my side the sample project run as expected. I would be grateful to you if you provide me with a simplified sample version of your project demonstrating the problematic behaviour. Then I could debug it locally and give you the most appropriate solution.
Looking forward to your reply.
Best regards,
Martin
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
On my side the sample project run as expected. I would be grateful to you if you provide me with a simplified sample version of your project demonstrating the problematic behaviour. Then I could debug it locally and give you the most appropriate solution.
Looking forward to your reply.
Best regards,
Martin
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.