or

private void Form1_Load(object sender, EventArgs e) { PopulateGrid(); radGridView1.Relations.AddSelfReference(radGridView1.MasterTemplate, "ID", "ParentID"); } private void PopulateGrid() { BindingList<RowBindingInfo> rowList = new BindingList<RowBindingInfo>(); int rowID = -1; for (int i = 0; i < 1; i++) { RowBindingInfo rowInfo = new RowBindingInfo(++rowID, -1, false, "Room " + i.ToString(), "Desc " + i.ToString()); rowList.Add(rowInfo); int pid = rowID; for (int j = 0; j < 250; j++) { RowBindingInfo childRow = new RowBindingInfo(++rowID, pid, false, string.Empty, "Desk " + j.ToString()); rowList.Add(childRow); } } radGridView1.DataSource = rowList; }}public class RowBindingInfo{ public RowBindingInfo(int rid, int prid, bool incl, string r, string d) { ID = rid; ParentID = prid; Included = incl; Room = r; Desc = d; } public int ID { get; set; } public int ParentID { get; set; } public bool Included { get; set; } public string Room { get; set; } public string Desc { get; set; }}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 FunctionPrivate 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 SubcommandBarChild.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 IfEnd SubPrivate Sub RadGridView1_ViewCellFormatting(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles RadGridView1.ViewCellFormatting HideFilterText(e.CellElement)End SubFriend 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 TryEnd Sub'Build Tree ViewPrivate 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