or
Need some help here...
I'm exporting a RadDataGrid to CSV but get the 'object reference to instance of an object' error. Every time i have a empty *.csv doc and the csvExporter.RunExport crashes...
Changing it to an Excel exporter makes it work fine.
code:
Dim exportGridView As New Telerik.WinControls.UI.RadGridView
exportGridView.DataSource = rep.GetObjectCorrespondentieGegevens(projectId)
Public Function GetObjectCorrespondentieGegevens(ByVal id As Integer) As Object Implements ICorrespondentieRepository.GetObjectCorrespondentieGegevens
Dim model = From p In _db.tblAannemers.AsEnumerable() _
Select p.fldAannemerNaam
Return model
End Function
Private Shared Sub RunExportToCSV(ByVal fileName As String, ByRef gridView As RadGridView)
Dim csvExporter As ExportToCSV = New ExportToCSV(gridView)
'csvExporter.FileExtension = "txt"
'csvExporter.SummariesExportOption = SummariesOption.ExportAll
Try
'csvExporter.
csvExporter.SummariesExportOption = SummariesOption.DoNotExport
csvExporter.RunExport(fileName) ' this is where the exception happens :-(
Catch ex As Exception
End Try
End Sub
commandBarChild.Rows[0].Strips.Add(strip);
Private
Sub
RadGridView1_ToolTipTextNeeded(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.WinControls.ToolTipTextNeededEventArgs)
Handles
RadGridView1.ToolTipTextNeeded
If
TryCast(sender, GridFilterCellElement) IsNot
Nothing
Then
e.ToolTipText =
CType
(sender, GridCellElement).ToolTipText
End
If
End
Sub
Private
Sub
RadGridView1_ViewCellFormatting(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.WinControls.UI.CellFormattingEventArgs)
Handles
RadGridView1.ViewCellFormatting
HideFilterText(e.CellElement)
End
Sub
Friend
Sub
HideFilterText(
ByVal
CellElement
As
GridCellElement)
Dim
oFilterCellElement
As
GridFilterCellElement
Try
If
TryCast(CellElement, GridFilterCellElement) IsNot
Nothing
Then
oFilterCellElement =
CType
(CellElement, GridFilterCellElement)
oFilterCellElement.ToolTipText = oFilterCellElement.FilterOperatorText.Text.Replace(
":"
,
""
)
oFilterCellElement.FilterButton.ToolTipText = oFilterCellElement.FilterOperatorText.Text.Replace(
":"
,
""
)
oFilterCellElement.FilterOperatorText.Visibility = Telerik.WinControls.ElementVisibility.Collapsed
End
If
Catch
ex
As
Exception
' Do nothing
End
Try
End
Sub
'Build Tree View
Private
Sub
BuildtvOrgan()
tvOrgan.RelationBindings.Add(
New
RelationBinding(
"CompanyDepts"
,
Me
.DepartmentBindingSource))
tvOrgan.RelationBindings.Add(
New
RelationBinding(
"Department_Employee"
,
Me
.EmployeeBindingSource))
tvOrgan.RelationBindings.Item(0).DisplayMember =
"DeptName"
tvOrgan.RelationBindings.Item(0).ValueMember =
"id"
tvOrgan.RelationBindings.Item(0).DataSource = DepartmentBindingSource
tvOrgan.RelationBindings.Item(1).DisplayMember =
"FName"
tvOrgan.RelationBindings.Item(1).ValueMember =
"id"
tvOrgan.RelationBindings.Item(1).DataSource = EmployeeBindingSource
tvOrgan.DataSource = CompanyBindingSource
tvOrgan.ValueMember =
"id"
SetImages(tvOrgan.Nodes)
tvOrgan.ExpandAll()
End
Sub
If
m_Theme = AvailableThemes.ControlDefault
Then
m_CurrentTheme = Telerik.WinControls.ThemeResolutionService.GetTheme(
"ControlDefault"
)
name =
"ControlDefault"
Else
If
Not
ThemeLoaded(name)
Then
ThemeResolutionService.LoadPackageResource(name &
".tssp"
)
End
If
End
If
m_CurrentTheme = Telerik.WinControls.ThemeResolutionService.GetTheme(name)
Telerik.WinControls.ThemeResolutionService.ApplicationThemeName = name
m_CurrentTheme.AddColorBlend(blend.Name, blend.BaseHslColor)
m_CurrentTheme.ThemeProperties(blend.Name) = blend.BlendHslColor
AvailableThemes
is an enumeration of theme names. All other themes except ControlDefault are assembly Resources (tssp files).