none
how to copy Datagrid data in Excel on base of row and cell level too, even using datatemplate inside textblock

    Question

  • hi I have Data grid which has Datatemplate also inside TextBlock,

    i want to give user flexiblity to copy data from data grid on cell level and row level and paste in execl.

    how we can do?

    Friday, August 19, 2011 10:43 AM

Answers

  • The IE version shouldn't matter*. The only thing that would matter is the version of Silverlight on the "client" machine. If running from VS2008, then you're using Silerlight 3, if running from 2010, then you're using Silverlight 4. It might also be possible that you do not have the latest version of 4. An update was released earlier this year to Silverlight 4. I don't see an issue about DataGrid copy being fixed, but that doesn't mean it wasn't. I don't think that I've had any problems getting copy to work, regardless of DataColumn used.

    Thursday, August 25, 2011 11:55 AM

All replies

  • Take a look at this post and the source code for it.

    There is also the ClipboardCopyMode for the DataGrid, but this only allows for the Row.

     

    Saturday, August 20, 2011 9:38 PM
  • Thanks Shawan,

    i have question, i have running code , but i found one strange thing, when i run my code on  (VS 2008 Code)

    , then i can see all my data copy properly (including if i have template in data grid i can see these data too),

    but when i tried to run on (VS 2010 Code) , then i do see my data copy from data grid but not data template value copy only copying

     here i found IE version also

    IE  8.0.6001.18702 works

    But IE 8.0.7601.17514 not work 

    DataGridTextColumn

    not value from

     

    <data:DataGridTemplateColumn Header="City11" CanUserSort="True"   SortMemberPath="City11"  IsReadOnly="True"  CanUserResize="True">
                        <data:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding City11,Mode=TwoWay}" />
                            </DataTemplate>
                        </data:DataGridTemplateColumn.CellTemplate>
                    </data:DataGridTemplateColumn>
     
    why how i can do?

     

    Tuesday, August 23, 2011 9:19 AM
  • The IE version shouldn't matter*. The only thing that would matter is the version of Silverlight on the "client" machine. If running from VS2008, then you're using Silerlight 3, if running from 2010, then you're using Silverlight 4. It might also be possible that you do not have the latest version of 4. An update was released earlier this year to Silverlight 4. I don't see an issue about DataGrid copy being fixed, but that doesn't mean it wasn't. I don't think that I've had any problems getting copy to work, regardless of DataColumn used.

    Thursday, August 25, 2011 11:55 AM
  • Hai !!! Shawn

                   Here is the link to export Data from Datagrid ....Have a look....... You may get some idea.........

    http://sanjoyinfoworld.blogspot.in/2011/08/how-to-export-data-grid-datas-to-excel.html


    Thanks & Regards,
    Sanjay
    Please "Mark as Answer",If it helped you.Bcz It may help others too.
    Friday, August 26, 2011 1:50 AM