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

CSV Exporting

6 Answers 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Me Mo
Top achievements
Rank 1
Me Mo asked on 14 Jul 2010, 06:06 PM
Hello,
We are having a problem with RadGrid export to CSV format,
we have a grid with a template column containing textbox bound to a string field,
When exporting to excel or to word or to pdf, it works fine,
but exporting to CSV doesn't export template columns
Below is the template column.
<telerik:GridTemplateColumn DataField="Field1" SortExpression="Field1"
                                  UniqueName="Field1
"
HeaderText="<%$ Resources:Distributor_resource, Field1%>"
                                  AllowFiltering="true" 
                                  <ItemTemplate>
                                      <asp:TextBox ID="txtField1
"
runat="server" Text='<%#Bind("Field1")%>'></asp:TextBox>
                                  </ItemTemplate>
                              </telerik:GridTemplateColumn>
Thanks in advance

6 Answers, 1 is accepted

Sort by
0
Lenny_shp
Top achievements
Rank 2
answered on 14 Jul 2010, 07:14 PM
Does this work?

<MasterTableView UseAllDataFields="true" ..
0
Accepted
Daniel
Telerik team
answered on 14 Jul 2010, 08:44 PM
Hello,

@Lenny_shp - This makes sense only when exporting to ExcelML format. It is needed when binding to custom obejcts, LinqDataSource, etc

@Me Mo - Please try the "Exporting unsupported controls" approach shown in the CSV export topic

Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Me Mo
Top achievements
Rank 1
answered on 15 Jul 2010, 12:23 PM
Thanks alot
It worked when i added the following code at the button click, but I had to give a value to the column  UniqueName property.

foreach (GridDataItem item in grid.MasterTableView.Items)
                {
                    TextBox txtBoxCode = item["Field1"].FindControl("txtbox") as TextBox;
                    item["Field1"].Text = txtBoxCode.Text;
                }
                grid.MasterTableView.ExportToCSV();
0
Chuck Lane
Top achievements
Rank 1
answered on 26 Jul 2010, 10:24 PM
Is there a comparable way to do this when exporting to excelML?

I've got template columns that have literal controls in them and I loop through the grid master items find the literals and
I'm assigning them to the item[UniqueName].Text as described in the documentation but I'm still just seeing blank columns in my excel export or no columns at all.

If I export the exact same setup to HTML it exports the template columns correctly but It breaks the columns up into too many rows.
Those columns that have a literal in them with more than one line get broken into several rows and there is no border between the individual rows.

Any help with this would be greatly appreciated

Chuck
0
Daniel
Telerik team
answered on 27 Jul 2010, 03:28 PM
Hello Chuck,

ExcelML allows that you change the structure of the worksheet so that you can add the missing content manually. I attached a simple demo to this post.

Best regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stanislav Dudnyk
Top achievements
Rank 1
answered on 31 Aug 2010, 07:57 AM
How I can export to CSV format grid with template column containing LinkButton but not use external buttons?
I want use standart grid button for CVS export
Tags
Grid
Asked by
Me Mo
Top achievements
Rank 1
Answers by
Lenny_shp
Top achievements
Rank 2
Daniel
Telerik team
Me Mo
Top achievements
Rank 1
Chuck Lane
Top achievements
Rank 1
Stanislav Dudnyk
Top achievements
Rank 1
Share this question
or