RadGridView ToHtml() results missing column data

2 posts, 0 answers
  1. Mark
    Mark avatar
    13 posts
    Member since:
    Aug 2012

    Posted 21 Mar 2012 Link to this post

    I am creating an exported Excel file from a RadGRidView via the ToHtml() method. However, some of the columns are missing data. Below is an example of two columns from the grid. The first (Description) results in valid data. The second (Coupon) has no data in the resultant Excel column:

                            <telerikGV:GridViewDataColumn UniqueName="Description"    IsReadOnly="True" Header="Description" Width="200">
                                            <uc1:NextFocusTextBox Text="{Binding Path=Description}" IsReadOnly="True" Background="White" Height="22" />

                            <telerikGV:GridViewDataColumn UniqueName="Coupon"         IsReadOnly="True" Header="Coupon (%/yr)" Width="95">
                                            <uc1:NextFocusTextBox Text="{Binding Path=Bond.Coupon, Converter={StaticResource ValueConverterNumericDash}, ConverterParameter=0:N3}" BorderThickness="0" IsReadOnly="True" IsEnabled="{Binding IsEnabled}" />

    The code behind to produce the results is:

    private void mbToolBar_ExcelExportClicked(object sender, EventArgs e)
        _printFileName                = "some_location" + MainPage.Username + ".xls";

        Uri uri                       = new Uri(_wcf.InnerChannel.Via.AbsoluteUri.Replace(_wcf.InnerChannel.Via.AbsolutePath, "/PrintHandler.aspx?FileName=" + _printFileName));

        WebClient client              = new WebClient();

        client.UploadStringCompleted += new UploadStringCompletedEventHandler(client_UploadExcelCompleted);

        client.UploadStringAsync(uri, BondGrid.ToHtml());

        BondGrid.IsBusy               = true;

  2. Vlad
    Vlad avatar
    11100 posts

    Posted 22 Mar 2012 Link to this post


     The grid cannot export columns with defined CellTemplate. You should handle ElementExporting and assign e.Value to desired for these columns similar to our exporting demo. 

    Kind regards,
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top