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

Removing controls in header when exporting

3 Answers 154 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Casey
Top achievements
Rank 1
Casey asked on 21 Nov 2011, 07:28 PM
I have a grid that has checkboxes in the header. I am trying to figure out a way to remove these checkboxes upon exporting and am having no luck. I column header contains the checkbox control and a linkbutton. I tried clearing the cell and then adding just the linkbutton back, but the extract still showed the checkbox data. There must be a simpler way of accomplishing this. Does anyone have any ideas?

(the columns are created dynamically which is why there is a loop)

'failed attempt at removing the checkboxes from the header
Dim commandItem As GridItem
For Each commandItem In radGridExport.MasterTableView.GetItems(GridItemType.Header)
    Dim hdrItem As GridHeaderItem = CType(commandItem, GridHeaderItem)
    Dim chkbox As CheckBox = CType(hdrItem.FindControl("cbAll"), CheckBox)
    chkbox.Visible = False
    For j As Integer = 16 To hdrItem.Cells.Count - 1
        Dim ctrl As LinkButton = CType(hdrItem.Cells(j).Controls(0), LinkButton)
        If ctrl IsNot Nothing Then
            Dim val As Integer = 0
            Integer.TryParse(ctrl.Text, val)
            If val > 0 Then
                hdrItem.Cells(j).Controls.Clear()
                hdrItem.Cells(j).Controls.Add(ctrl)
            End If
        End If
    Next
Next

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Nov 2011, 04:34 AM
Hello Casey,

Try setting the property ExportOnlyData as true.
aspx:
<ExportSettings ExportOnlyData="true"></ExportSettings>

-Shinu.
0
Casey
Top achievements
Rank 1
answered on 22 Nov 2011, 09:57 PM
I already tried that. The example screenshots attached below were generated with that property set to True. Can you think of another way of accomplishing this?
0
Shinu
Top achievements
Rank 2
answered on 23 Nov 2011, 05:40 AM
Hello Casey,

I cannot reproduce the issue at my end. Check the following help documentation which explains about exporting.
Word/Excel export (HTML-based)

-Shinu.
Tags
Grid
Asked by
Casey
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Casey
Top achievements
Rank 1
Share this question
or