RadGrid HeaderContext filter menu throws '_linkElement' undefined error after expand animation ends in version 2026.1.211.462
After clicking the filter icon in a RadGrid column header, the filter menu throws the following JavaScript error in the browser console:
Uncaught TypeError: Cannot read properties of undefined (reading '_linkElement')
at Object._focusFirstItem
at Object.raise_expandAnimationEnded
at Object._onExpandAnimationEnded
Environment:
- Telerik UI for ASP.NET AJAX version: 2026.1.211.462
- ASP.NET Framework: 4.8.1
- Browser: Chrome (latest)
- FilterType: default
- RadScriptManager with no custom script references
Steps to reproduce:
1. Place a RadGrid with AllowFilteringByColumn="true"
2. Run the application
3. Click the filter icon on any column header
4. Observe the JavaScript error in the browser console after the menu animation completes
Expected behavior:
The filter menu opens and focus is set on the first menu item without any errors.
Actual behavior:
The filter menu disappears visually, does not appear, and throws a JS exception when attempting to focus the first item (_linkElement is undefined)
Hi Andrzej,
Thank you for clarifying the clearing of the items in the init event. I managed to get the error and found where it is being thrown in our source code. I have logged this as a bug and updated your Telerik Points. For the time being, you can use the below override until an official fix is implemented:
(function () {
try {
let $T = Telerik.Web.UI;
let original_focusFirstItem = Telerik.Web.UI.RadGrid.prototype._focusFirstItem;
if ($T && $T.RadGrid) {
$T.RadGrid.prototype._focusFirstItem = function () {
let that = this;
let firstItem = that._filterMenu.get_focusedItem() || that._filterMenu.get_items().getItem(0);
if (firstItem) {
original_focusFirstItem.call(that);
}
};
}
} catch { }
})();
Regards,
Vasko
Progress Telerik
Add to your code:
<telerik:RadGrid ID="RadGrid1" runat="server"
OnInit="RadGrid1_Init"....
protected void RadGrid1_Init(object sender, EventArgs e)
{
GridFilterMenu menu = RadGrid1.FilterMenu;
menu.Items.Clear();
}
and run it.
After clicking on the filter in RadGrid, an error will appear in the browser console:
Hello Andrzej,
I understand your concern regarding the issue being a potential bug, and I would like to investigate it further, however, since I cannot reproduce it with the shared code, I would like to ask you to share more details regarding it.
How is the header context menu erroring out, what steps do you take in order to get the error, are there specific actions needed to be done before opening the context menu? Sharing as much information as possible will help me investigate and understand the issue better and lead to a potential resolution.
I await your response.
Regards,
Vasko
Progress Telerik
We understood the issue and fixed it on our end. However, I still believe that not handling the client-side exception for an empty collection is a bug.
Hello Andrzej,
Thank you for providing an adjusted version of the code, however, even with it I was not able to get the error, you can take a look at the attached video to see the result on my end.
From the shared code, I can see that you are dynamically translating the filter options to polish, which is not incorrect to do so, as the only thing changed is the Text of the option, however, since this results in an error on your end, I strongly recommend using a .resx file to configure the localization of the Grid, as this is generally the correct and optional way of changing the localization.
Regards,
Vasko
Progress Telerik
Deleting all filter menu items causes this error.
<telerik:RadGrid ID="RadGrid1" runat="server"
OnInit="RadGrid1_Init"
OnNeedDataSource="RadGrid1_NeedDataSource"
Width="800px"
EnableHeaderContextMenu="true"
FilterType="Classic"
AllowSorting="True" AllowPaging="True" PageSize="10"
AllowFilteringByColumn="true" AutoGenerateColumns="false"
GridLines="Both"
GroupingSettings-CaseSensitive="false"
AllowCustomPaging="true"
EnableLinqExpressions="false"
>
<MasterTableView AutoGenerateColumns="False" DataKeyNames="OrderID">
<Columns>
<telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32"
FilterControlAltText="Filter OrderID column" HeaderText="OrderID"
ReadOnly="True" SortExpression="OrderID" UniqueName="OrderID">
</telerik:GridBoundColumn>
<telerik:GridDateTimeColumn DataField="OrderDate" DataType="System.DateTime"
FilterControlAltText="Filter OrderDate column" HeaderText="OrderDate"
SortExpression="OrderDate" UniqueName="OrderDate">
</telerik:GridDateTimeColumn>
<telerik:GridNumericColumn DataField="Freight" DataType="System.Decimal"
FilterControlAltText="Filter Freight column" HeaderText="Freight"
SortExpression="Freight" UniqueName="Freight">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn DataField="ShipName"
FilterControlAltText="Filter ShipName column" HeaderText="ShipName"
SortExpression="ShipName" UniqueName="ShipName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ShipCountry"
FilterControlAltText="Filter ShipCountry column" HeaderText="ShipCountry"
SortExpression="ShipCountry" UniqueName="ShipCountry">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
protected void RadGrid1_Init(object sender, EventArgs e)
{
GridFilterMenu menu = RadGrid1.FilterMenu;
SetRadGridFilterMenu(menu);
}
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
(sender as RadGrid).DataSource = OrdersTable();
}
private DataTable OrdersTable()
{
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("OrderID", typeof(int)));
dt.Columns.Add(new DataColumn("OrderDate", typeof(DateTime)));
dt.Columns.Add(new DataColumn("Freight", typeof(double)));
dt.Columns.Add(new DataColumn("ShipName", typeof(string)));
dt.Columns.Add(new DataColumn("ShipCountry", typeof(string)));
dt.PrimaryKey = new DataColumn[] { dt.Columns["OrderID"] };
for (int i = 0; i < 10; i++)
{
int index = i + 1;
DataRow row = dt.NewRow();
row["OrderID"] = index;
row["OrderDate"] = DateTime.Now.Date.AddDays(index);
row["Freight"] = index * 0.01;
row["ShipName"] = "Name " + index;
row["ShipCountry"] = "Country " + index;
dt.Rows.Add(row);
}
return dt;
}
protected void SetRadGridFilterMenu(GridFilterMenu menu)
{
int i = 0;
while (i < menu.Items.Count)
{
if (menu.Items[i].Text == "NoFilter")
{
menu.Items[i].Text = "Bez_Filtracji";
i++;
}
else if (menu.Items[i].Text == "StartsWith")
{
menu.Items[i].Text = "Zaczynające_Się_Od";
i++;
}
else if (menu.Items[i].Text == "EqualTo")
{
menu.Items[i].Text = "Równe";
i++;
}
else if (menu.Items[i].Text == "NotEqualTo")
{
menu.Items[i].Text = "Różne";
i++;
}
else if (menu.Items[i].Text == "GreaterThan")
{
menu.Items[i].Text = "Większe";
i++;
}
else if (menu.Items[i].Text == "LessThan")
{
menu.Items[i].Text = "Mniejsze";
i++;
}
else if (menu.Items[i].Text == "GreaterThanOrEqualTo")
{
menu.Items[i].Text = "Większe_Równe";
i++;
}
else if (menu.Items[i].Text == "LessThanOrEqualTo")
{
menu.Items[i].Text = "Mniejsze_Równe";
i++;
}
else if (menu.Items[i].Text == "Contains")
{
menu.Items[i].Text = "Zawiera";
i++;
}
else if (menu.Items[i].Text == "IsNull")
{
menu.Items[i].Text = "Brak_Wpisu";
i++;
}
else if (menu.Items[i].Text == "NotIsNull")
{
menu.Items[i].Text = "Większy_lub_BrakWpisu";
i++;
}
else
{
menu.Items.RemoveAt(i);
}
}
}
}
Hi Andrzej,
I tried to replicate the issue on my end, but was not able to due to missing details (grid markup, client-side code etc). Below is the code I used for testing:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" Width="800px" AllowFilteringByColumn="true"
EnableHeaderContextMenu="true" FilterType="HeaderContext" OnNeedDataSource="RadGrid1_NeedDataSource">
<MasterTableView AutoGenerateColumns="False" DataKeyNames="OrderID">
<Columns>
<telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32"
FilterControlAltText="Filter OrderID column" HeaderText="OrderID"
ReadOnly="True" SortExpression="OrderID" UniqueName="OrderID">
</telerik:GridBoundColumn>
<telerik:GridDateTimeColumn DataField="OrderDate" DataType="System.DateTime"
FilterControlAltText="Filter OrderDate column" HeaderText="OrderDate"
SortExpression="OrderDate" UniqueName="OrderDate">
</telerik:GridDateTimeColumn>
<telerik:GridNumericColumn DataField="Freight" DataType="System.Decimal"
FilterControlAltText="Filter Freight column" HeaderText="Freight"
SortExpression="Freight" UniqueName="Freight">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn DataField="ShipName"
FilterControlAltText="Filter ShipName column" HeaderText="ShipName"
SortExpression="ShipName" UniqueName="ShipName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ShipCountry"
FilterControlAltText="Filter ShipCountry column" HeaderText="ShipCountry"
SortExpression="ShipCountry" UniqueName="ShipCountry">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
(sender as RadGrid).DataSource = OrdersTable();
}
private DataTable OrdersTable()
{
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("OrderID", typeof(int)));
dt.Columns.Add(new DataColumn("OrderDate", typeof(DateTime)));
dt.Columns.Add(new DataColumn("Freight", typeof(double)));
dt.Columns.Add(new DataColumn("ShipName", typeof(string)));
dt.Columns.Add(new DataColumn("ShipCountry", typeof(string)));
dt.PrimaryKey = new DataColumn[] { dt.Columns["OrderID"] };
for (int i = 0; i < 10; i++)
{
int index = i + 1;
DataRow row = dt.NewRow();
row["OrderID"] = index;
row["OrderDate"] = DateTime.Now.Date.AddDays(index);
row["Freight"] = index * 0.01;
row["ShipName"] = "Name " + index;
row["ShipCountry"] = "Country " + index;
dt.Rows.Add(row);
}
return dt;
}
Test it on your end and try to adjust it so that it reproduces the error.
Regards,
Vasko
Progress Telerik