We are having issues when applying refreshed combo box filters in addition to using NestedViews. Once we apply filters and rebind the NestedViews will no longer open/expand.
What I believe is happening is that Prerender is being invoked for both the filter as well as the NestedView expand. In PreRender I am calling a function that refreshes our filter combo boxes to relevant options post filter and rebinds the grid. At this point the filter is != string.Empty and when the row is clicked to expand the NestedView prerender fires again and my function is again called rebinding the grid and collapsing the NestedView. My question: is there any way to avoid this collision? Would it be possible to detect who invoked Prerender or move the combo refresh to Javascript?
We want to achieve the following goals:
Code is below:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
if (RadGrid1.MasterTableView.FilterExpression != string.Empty)
{
RefreshCombos();
}
}
protected void RefreshCombos()
{
SqlDataSourceVP.SelectCommand = SqlDataSourceVP.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression;
SqlDataSourceTransStatus.SelectCommand = SqlDataSourceTransStatus.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression;
SqlDataSourceTransType.SelectCommand = SqlDataSourceTransType.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression;
RadGrid1.MasterTableView.Rebind();
}
What I believe is happening is that Prerender is being invoked for both the filter as well as the NestedView expand. In PreRender I am calling a function that refreshes our filter combo boxes to relevant options post filter and rebinds the grid. At this point the filter is != string.Empty and when the row is clicked to expand the NestedView prerender fires again and my function is again called rebinding the grid and collapsing the NestedView. My question: is there any way to avoid this collision? Would it be possible to detect who invoked Prerender or move the combo refresh to Javascript?
We want to achieve the following goals:
- Refresh several combobox filter dropdowns after the user has filtered on a field, and rebind the grid
- Utilize nested views after filtering
Code is below:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
if (RadGrid1.MasterTableView.FilterExpression != string.Empty)
{
RefreshCombos();
}
}
protected void RefreshCombos()
{
SqlDataSourceVP.SelectCommand = SqlDataSourceVP.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression;
SqlDataSourceTransStatus.SelectCommand = SqlDataSourceTransStatus.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression;
SqlDataSourceTransType.SelectCommand = SqlDataSourceTransType.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression;
RadGrid1.MasterTableView.Rebind();
}