开发者

Why RadFilter is not detecting Columns correctly?

I am having trouble that RadFilter is not detecting the columns correctly. I bind my RadGrid through code in Asp like:

RadGrid1.DataSource = myDataSource; RadGrid.DataBind();

RadFilter is only bi开发者_运维百科nding those columns which are bind through and ignoring those who are in . Is this a known issue? as I didn't see any thread talking about this problem. Waiting for help immediately.

Regards, Wasim.


If I am understanding you correctly, you need to add FilterFieldEditors to the RadFilter for any field that is not represented in the DataSource for the grid.

You can add filters dynamically with the following code.

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    if (!IsPostBack)
    {
        var fieldName = "myDynamicFilterField";
        var friendlyName = "Friendly Dynamic Field";
        var newTextFieldEditor = new RadFilterTextFieldEditor();

        filter.FieldEditors.Add(newTextFieldEditor);
        newTextFieldEditor.FieldName = fieldName;       // name filter will used for filter exressions
        newTextFieldEditor.DisplayName = friendlyName;  // name use will see when they selected a field to filter

        // ** Repeat for all dynamic fields **
    }
}

I was able to get a working version using auto generated columns and custom added columns, but ran into many other problems. I ended up just dynamically creating all the filter fields (as shown above) from the data source and applying the filter expression to the grid.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜