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

export dynamically created datarow in radgrid

1 Answer 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Priya
Top achievements
Rank 1
Priya asked on 23 Mar 2009, 06:06 AM
sir
On need datasource i have added a column to the dataset dynamically.but when i click export,that column data are not coming
RadGridSCType_DetailTableDataBind()  
Dim dsaddedDoc As New DataSet  
dsaddedDoc = objSC_documentsBAL.SelectAllDocumentsofSC()  
'Revision Prefix  
Dim revisionwithprefix As New DataColumn  
dsaddedDoc.Tables(0).Columns.Add(revisionwithprefix)  
dsaddedDoc.Tables(0).Columns("column1").ColumnName = "revisionwithprefix" 
If dsaddedDoc.Tables(0).Rows.Count > 0 Then  
Dim prefix As String = GetRevisionPrefix()  
Dim row As DataRow  
For Each row In dsaddedDoc.Tables(0).Rows  
 If row("Rev_No_Detail").ToString <> "" Then  
    row("revisionwithprefix") = prefix + row("Rev_No_Detail").ToString  
  End If  
Next  
 End If  
e.DetailTableView.DataSource = dsaddedDoc 
RadGridSCType_ItemCommand () 
If e.CommandName = "Export" Then  
RadGridSCType.MasterTableView.HierarchyDefaultExpanded = True 
                     RadGridSCType.Rebind()  
                    RadGridSCType.ExportSettings.OpenInNewWindow = True 
                    RadGridSCType.ExportSettings.ExportOnlyData = True 
                    RadGridSCType.ExportSettings.IgnorePaging = True 
                    RadGridSCType.MasterTableView.ExportToExcel() 
revisionwithprefix data is not coming..only the data coming directly from the database is displaying..

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 26 Mar 2009, 07:28 AM
Hi Priya,

When exporting, you can rebind the control, to make sure the NeedDataSource/DetailTableDataBind event handlers are raised, and the proper data is passed to the control. Additionally, you can disable columns ViewState, to ensure the changes in the structure are reflected.
I hope these suggestions help.

Best wishes,
Yavor
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Priya
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or