I am having issues where data getting exported to an XLSX file where some tabs are not getting the data. FileExportMode is set to FileExportMode.NewSheetInExistingFile and the file is not in use. The weird part, is I can run the code multiple times and each time, it is different tabs that don't get populated. In the end, I should end up with 14 tabs and I get those 14 tabs, the only thing that is in the tabs, is the headers. if I export that data for each tabs individual to their own file, the data is there and exported as expected. Maybe I am missing something?
Another weird part, is when I watch the file exporting (in window explorer), you can see the file go to 0KB. It is really weird
Here is my export code
List<Tuple<int, string, bool>> jurisdictionTypes =
new JurisdictionTypeDA().GetJurisdictionTypeKeyValueList();
foreach (Tuple<int, string, bool> jurisdictionType in jurisdictionTypes)
{
RadPivotGrid tempPivotExportGrid = new RadPivotGrid
{
ColumnGrandTotalsPosition = TotalsPos.None,
ColumnsSubTotalsPosition = TotalsPos.None,
EmptyValueString = "0",
RowGrandTotalsPosition = TotalsPos.None,
RowsSubTotalsPosition = TotalsPos.None
};
var exportResults = _apportionmentInfoPivot
.Where(app => app.JurisdictionTypeKey == jurisdictionType.Item1
.OrderBy(app => app.PartySort)
.ThenBy(app => app.LegacyKeyValue)
.Select(app => new
{
jurisdiction_name = app.JurisdictionName?.Trim() ?? string.Empty,
party_name = app.PartyName?.Trim() ?? string.Empty,
totalvoters = app.TotalVoters,
signaturesneeded = app.SignaturesNeeded
})
.ToList();
tempPivotExportGrid.DataSource = exportResults;
tempPivotExportGrid.RowGroupDescriptions.Clear();
tempPivotExportGrid.ColumnGroupDescriptions.Clear();
tempPivotExportGrid.AggregateDescriptions.Clear();
// Row Information
PropertyGroupDescription myRows = new PropertyGroupDescription
{
PropertyName = "jurisdiction_name",
CustomName = "Jurisdiction",
SortOrder = Telerik.Pivot.Core.SortOrder.None
};
tempPivotExportGrid.RowGroupDescriptions.Add(myRows);
// Column Information
PropertyGroupDescription myCols = new PropertyGroupDescription
{
PropertyName = "party_name",
CustomName = "Party",
SortOrder = Telerik.Pivot.Core.SortOrder.None
};
tempPivotExportGrid.ColumnGroupDescriptions.Add(myCols);
// Aggregate Information
tempPivotExportGrid.AggregateDescriptions.Add(new PropertyAggregateDescription()
{
PropertyName = "totalvoters",
CustomName = "Count",
AggregateFunction = AggregateFunctions.Sum,
StringFormat = "#,##0"
});
tempPivotExportGrid.AggregateDescriptions.Add(new PropertyAggregateDescription()
{
PropertyName = "signaturesneeded",
CustomName = "Needed",
AggregateFunction = AggregateFunctions.Sum,
StringFormat = "#,##0"
});
tempPivotExportGrid.AggregatesPosition = PivotAxis.Columns;
// Combine each result into a new tab
PivotGridSpreadExport spreadExport = new PivotGridSpreadExport(tempPivotExportGrid)
{
SheetName = jurisdictionType.Item2,
FileExportMode = FileExportMode.NewSheetInExistingFile
};
spreadExport.RunExport(myExportFile, new SpreadExportRenderer());
// Send each result to their own sheet
PivotGridSpreadExport mySpreadExport2 = new PivotGridSpreadExport(tempPivotExportGrid)
{
SheetName = jurisdictionType.Item2,
FileExportMode = FileExportMode.CreateOrOverrideFile
};
string newfile = string.Concat(Path.Combine(Path.GetDirectoryName(myExportFile) ?? string.Empty, Path.GetFileNameWithoutExtension(myExportFile)), "_", jurisdictionType.Item2, Path.GetExtension(myExportFile));
mySpreadExport2.RunExport(newfile, new SpreadExportRenderer());
}
Due to the nature of the data, I can't share the results, so I will try to re-create this in a temp project.
I have attached a like to a video, you can see at 4 seconds and 9 seconds, the file is emptied (0 KB).
https://app.screencast.com/6SjZNCAoooWUh
TIA for any help here.
I am trying to figure out if updating different packages in my project is possible and would like to find the documentation for my Telerik version. I have a old version and can't find relevant information anywhere.
Is there some legacy page i can view?
Hi Dinko and Team,
As I mentioned in my previous forum, The below code is working in VS 2022 with 2013.3.1.1127 where as throwing stackoverflow exception in VS 2022 with Telerk 2024.1.130.48. Out product code structure is like below and we cannot declare and initialize the datatable globally. If we did that the whole application will get impact . Hence could you please restrict the recursive call of Raddropdownlist.Datasource and Raddropdownlist.SelectedIndex also like Raddropdownlist.SelectedValue. Which I raised in my previous forum
public void fillIndustryProcess()
{
try
{
System.Data.DataTable dt1 = new System.Data.DataTable();
if (dt1.Columns.Count <= 0)
{
dt1.Columns.Add("Industry", typeof(string));
dt1.Columns.Add("ID", typeof(int));
dt1.Rows.Add("USA-0", 0);
dt1.Rows.Add("USA-1", 1);
dt1.Rows.Add("USA-2", 2);
dt1.Rows.Add("USA-3", 3);
dt1.Rows.Add("USA-4", 4);
radDropDownList2.DisplayMember = "Industry";
radDropDownList2.ValueMember = "ID";
}
radDropDownList2.DataSource = dt1; ;//Still stack overflow exception occurring when bind the radDropDownList
radDropDownList2.SelectedIndex = 0;
}
catch (System.ComponentModel.Win32Exception ex)
{
throw ex;
}
}
Thanks,
Maheswari
Hello,
I am trying to drag an item from a form Gridview to a Scheduler control but could not see any Scheduler Dragover event got fired. I have set the Scheduler AllowDrop property to true and my code to initiate the transfer is gridview1.DoDragDrop(sTDF, DragDropEffects.Move). Help is apprevciated.
Thanks
Peter
Hi Dinko and Team,
As I mentioned in the previous forum, We need fix for Raddropdownlist.SelectedIndex.
When we set SelectedIndex=5 or some value in selectedIndexchangedEvent then the recursive call is happening for SelectedIndex. So we need to restrict the recursive call for both Raddropdownlist.DataSource as well as Raddropdownlist.SelectedIdex.
private void radDropDownList1_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{
fillIndustryProcess1(); // radDropDownList1.DataSource = dt; when we set Datasource the recursive call is occurring
radDropDownList1.SelectedIdex = 5; // radDropDownList1.SelectedIdex = 5; when we set Datasource the recursive call is occurring
}
public void fillIndustryProcess1()Old Forums in which , Telerik team fixed the RadDropDownList .SelectedValue.
Previous forums in which , Telerik team yet to fix for RadDropDownList.Datasource.
Thanks,
Maheswari
Hi Dinko and team ,
Tried to migrate from Visual studio 2010 project along with Telerik.WinControls.UI.dll - Version - 2013.3.1.1127 to Visual studio 2022 with Telerik.WinControls.UI.dll - Version 2023.1.314.
There are random stackoverflow exceptions throughout project. In older version Telerik 2013.3.1.1127 is working with no issues only in Visual studio 2022 Telerick 2023.1.314 creating issue.
Found the RadDropDownList is the root cause So
As Dinko | Tech Support Engineer Telerik suggested in forum tried the below code
cmbValveSize_SelectedIndexChanged -= cmbValveSize_SelectedIndexChanged;
cmbValveSize.SelectedValue = 3;
cmbValveSize.SelectedIndexChanged += cmbValveSize_SelectedIndexChanged;
The stackoverflow is got resolved at this point so we applied the same code wherever SelectedValue getting assigned throughout project but when we call recursive functions the SelectedValue is getting assigned as null since the assigned value is based on value member signature and datasource datatable also having value.
private void setComboBoxIndexChanged(RadDropDownList combobox, object selectedValue, Telerik.WinControls.UI.Data.PositionChangedEventHandler eventHandler)
{
if (eventHandler != null) { combobox.SelectedIndexChanged -= eventHandler; }
if (int.TryParse(Convert.ToString(selectedValue), out int result))
{
combobox.SelectedValue = result; //result having the value but assiging as null
if (combobox.SelectedValue == null && combobox.Name == "cmbValveSize")
{
DataTable dtValues = (DataTable)cmbValveSize.DataSource;
if(dtValues.Rows.Count > 0)
{
}
else
{
}
}
if (eventHandler != null) { combobox.SelectedIndexChanged += eventHandler; }
}
So what is causing in version 2023.1.314 RadDropDownList? why we need to do subscribe and unsubscribe for Telerik 2023.1.314 but not for Telerik 2013.3.1.1127 . What is the change between2013.3.1.1127 and 2023.1.314.
When is the change and Which version will overcome the stackoverflow issue in Visual studio 2022 after 2013.3.1.1127.? - Since we need the latest Telerik version for VS 2022 application.
Unsubscribe and subscribe is not a solution it is affecting the other functionalities of project.
Please suggest what we can do apart from Unsubscribe and subscribe.
Thanks,
Maheswari