using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RadGrid1.ItemCommand += new Telerik.Web.UI.GridCommandEventHandler(RadGrid1_ItemCommand);

    }

    protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == "Filter" &&  ((Pair)e.CommandArgument).Second.ToString() == "Categories.CategoryName")
        {
            if ( ((Pair)e.CommandArgument).First.ToString() == "IsNull")
            {
                e.Canceled = true;
                RadGrid1.MasterTableView.FilterExpression = "([Categories.CategoryName] IS NULL) OR ([Categories.CategoryID] IS NULL)";
                RadGrid1.Rebind();
            }
            else if (((Pair)e.CommandArgument).First.ToString() == "IsEmpty")
            {
                e.Canceled = true;
                RadGrid1.MasterTableView.FilterExpression = "([Categories.CategoryName] = '') OR ([Categories.CategoryID] IS NULL)";
                RadGrid1.Rebind();
            }
        }
    }

    protected override void OnPreRender(EventArgs e)
    {

        base.OnPreRender(e);

    }
}
