Hello,
I recently started to work on an old ASP.Net project and one of the first action I was asked to perform was to update Telerik version (from Q3 2012 to the last one).
The migration went almost well, but I have a problem in some specific situations : on every RadGrid with nested DetailTables, enable both HeaderContextMenu and HeaderContextFilterMenu causes a stack overflow exception during page loading.
Here is an example :
<
telerik:RadGrid
ID
=
"RGPhase"
runat
=
"server"
OnNeedDataSource
=
"RGPhase_NeedDataSource"
OnDetailTableDataBind
=
"RGPhase_DetailTableDataBind"
GridLines
=
"None"
PageSize
=
"500"
AutoGenerateColumns
=
"false"
Culture
=
"fr-FR"
EnableHeaderContextMenu
=
"true"
EnableHeaderContextFilterMenu
=
"false"
AllowFilteringByColumn
=
"true"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"False"
AllowAutomaticDeletes
=
"False"
AllowPaging
=
"True"
AllowSorting
=
"True"
ShowFooter
=
"True"
OnEditCommand
=
"RGPhase_EditCommand"
OnCancelCommand
=
"RGPhase_CancelCommand"
OnUpdateCommand
=
"RGPhase_UpdateCommand"
OnDeleteCommand
=
"RGPhase_DeleteCommand"
>
<
MasterTableView
DataKeyNames
=
"IdPhaseInAffaire"
IsFilterItemExpanded
=
"false"
CommandItemSettings-ShowRefreshButton
=
"false"
ShowGroupFooter
=
"true"
CommandItemDisplay
=
"Top"
CommandItemSettings-ShowAddNewRecordButton
=
"false"
>
<
NoRecordsTemplate
>
Aucune phase
</
NoRecordsTemplate
>
<
DetailTables
>
<
telerik:GridTableView
GridLines
=
"None"
PageSize
=
"500"
AutoGenerateColumns
=
"false"
EnableHeaderContextMenu
=
"false"
EnableHeaderContextFilterMenu
=
"false"
AllowFilteringByColumn
=
"true"
DataKeyNames
=
"IdPhaseInAffaire"
AllowAutomaticInserts
=
"false"
AllowAutomaticUpdates
=
"True"
AllowAutomaticDeletes
=
"false"
AllowPaging
=
"True"
AllowSorting
=
"True"
ShowFooter
=
"true"
CommandItemStyle-CssClass
=
"DontShow"
CommandItemSettings-ShowRefreshButton
=
"false"
IsFilterItemExpanded
=
"false"
ShowGroupFooter
=
"true"
CommandItemDisplay
=
"Top"
CommandItemSettings-ShowAddNewRecordButton
=
"false"
>
<
DetailTables
>
<
telerik:GridTableView
GridLines
=
"None"
PageSize
=
"500"
AutoGenerateColumns
=
"false"
EnableHeaderContextMenu
=
"false"
EnableHeaderContextFilterMenu
=
"false"
AllowFilteringByColumn
=
"true"
DataKeyNames
=
"IdPhaseInAffaire"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
AllowAutomaticDeletes
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
ShowFooter
=
"true"
CommandItemSettings-ShowRefreshButton
=
"false"
CommandItemStyle-CssClass
=
"DontShow"
IsFilterItemExpanded
=
"false"
ShowGroupFooter
=
"true"
CommandItemDisplay
=
"Top"
CommandItemSettings-ShowAddNewRecordButton
=
"false"
>
And the code behind associated :
protected
void
RGPhase_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
DataLoadOptions dlo =
new
DataLoadOptions();
dlo.LoadWith<PhaseInAffaire>(p => p.Phase);
RGPhase.DataSource = BLLPhase.GetAffairePhaseOnly(MyCompleteAffaire.IdAffaire, dlo);
}
protected
void
RGPhase_DetailTableDataBind(
object
sender, GridDetailTableDataBindEventArgs e)
{
var idPhaseInAffaire = (
int
)e.DetailTableView.ParentItem.GetDataKeyValue(
"IdPhaseInAffaire"
);
var pia = MyCompleteAffaire.PhaseInAffaire.Where(c => c.IdParent == idPhaseInAffaire).ToList();
e.DetailTableView.DataSource = pia;
}
When I set either "EnableHeaderContextMenu" or "EnableHeaderContextFilterMenu" to false, I have no problem loading the page.
Apparently the server is stuck in a recursive call of this method : Telerik.Web.UI.GridHeaderContextMenu.GridContextFilterTemplate.CheckForSpecialColumns(Telerik.Web.UI.GridTableView currentTableView).
Any help would be appreciated,
Thanks