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

Export removing leading zeros issue

2 Answers 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
thdwlgP
Top achievements
Rank 1
thdwlgP asked on 05 Jan 2012, 08:51 AM
I am trying to export the grid data as all string so that none of the numbers that start with zeros would be truncated in excel. So to do that I thought I could do something like this

     void RadGridView_DataLoaded(object sender, System.EventArgs e)
        {
                for (int i = 0; i < ColumnHeaders.Count; i++)
                {

                    (uxGrid.Columns[i] as GridViewBoundColumnBase).DataType = typeof(string);
                }
            }
        }


but the format exported is still in
<td>01 2012</td><td>0008000.0000</td><td>04395.70</td></tr> without the ="" so it looks like ="0008000.0000"

any ideas?

2 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 05 Jan 2012, 11:02 AM
Hello Jihae,

You can use the GridView.ElementExporting to modify the value that is being exported at the moment. 
You can see how this event can be used in our online example here. Or you can read about it in our documentation here.

Hope this helps! 

Kind regards,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
thdwlgP
Top achievements
Rank 1
answered on 05 Jan 2012, 06:36 PM
Is there a way to do that with version 2009.2.828.1030?


Tags
GridView
Asked by
thdwlgP
Top achievements
Rank 1
Answers by
Nick
Telerik team
thdwlgP
Top achievements
Rank 1
Share this question
or