New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Wrong Control is Filtered with Multiple Instances are Present on the Page
When the RadFilter and the control it filters are on a user control and you have more than one instance of the same user control on the page, the wrong control may be filtered.
This can happen if the filter is in a different INamingContainer
from the grid it filters.
What happens in such a case is the following:
- RadFilter looks for its target in the current NamingContainer.
- The target is not found, so the entire page control hierarchy must be traversed.
- RadFilter invokes a recursive
FindControl()
from thePage
orMasterPage
. - The first instance of the user control on the page meets the criteria and all filters from all instances work with the first instance.
To fix this use the UniqueID of the target:
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
RadFilter1.FilterContainerID = RadGrid1.UniqueID;
}
}