5 Answers, 1 is accepted
You do need the viewstate if you are to have multi-column filtering. As for the duplicate columns issue,have you wrapped your column creation code within a if (!IsPostBack){ } condition. Please, follow closely the instructions on programmatically creating the gird's structure given in the following help article (paragraph: Dynamically defining structure of a statically-declared grid):
http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html
I hope this helps.
Best wishes,Tsvetoslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

As mentioned before, this scenario is not supported. As for a work-around for maintaining the filterexpression, you can certainly do so by keeping the CurrentFilterValue and CurrentFilterFunction in a ViewState or Session variable and construct the filter expression over and over again on each postback.
Regards,Tsvetoslav
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.

please see the logic below
void RadGridItemCommand(object source, GridCommandEventArgs e)
if (commandName == RadGrid.FilterCommandName)
{
e.Canceled = true;
string filterExpress = ClearFilterExpression(e.Item.OwnerTableView.FilterExpression, gridBoundColumn.UniqueName);
BuildFilterExpression(colName, value, gridBoundColumn.DataTypeName, ref filterExpress);
e.Item.OwnerTableView.FilterExpression = filterExpress;
e.Item.OwnerTableView.OwnerGrid.Rebind();
}
}
private static string ClearFilterExpression(string filterExpression, string columnName)
{
filterExpression = filterExpression.Replace("(", string.Empty);
filterExpression = filterExpression.Replace(")", string.Empty);
string[] filterExpressionParts = filterExpression.Split(new string[] { " AND " }, StringSplitOptions.None);
ArrayList list = new ArrayList(filterExpressionParts);
for (int i = list.Count - 1; i >= 0; i--)
{
if (list[i].ToString().StartsWith("[" + columnName +"]"))
{
list.Remove(list[i]);
}
}
filterExpressionParts = (string[])list.ToArray(typeof(string));
return string.Join(" AND ", filterExpressionParts);
}
private static void BuildFilterExpression(string field, string value, string dataTypeName, ref string filterExpression)
{
string filter = "";
//http://www.telerik.com/help/aspnet-ajax/grid-operate-with-filter-expression-manually.html
if (dataTypeName == "System.String")
{
//filter = "(iif(" + field + "==null,\"\", " +
// field + ").ToString().Contains(\"" + value +
// "\"))";
filter = "([" + field + "] LIKE '%" + value + "%')";
}
else if (dataTypeName.Contains("System.Int"))
{
//if (!string.IsNullOrEmpty(field) && !string.IsNullOrEmpty(value))
// filter = "(" + field + "==" + value + ")";
filter = "([" + field + "] = " + value + ")";
}
if (filterExpression == "")
{
filterExpression = filter;
}
else
{
filterExpression = "((" + filterExpression + ") AND " + filter + ")";
}
}
The provided code seems to use global variables which complicates the task of finding the root cause of the issue. Could you please share with us the entire page markup and code-behind so we could carefully examine the implementation? Once we have a better view over the exact setup we should be able to provide a more precise answer.
Regards,
Angel Petrov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.