Esempio n. 1
0
        protected void RadGrid1_FilterCheckListItemsRequested(object sender, Telerik.Web.UI.GridFilterCheckListItemsRequestedEventArgs e)
        {
            MyASMXService service = new MyASMXService();
            var           y       = service.GetCustomers();

            if (e.Column is IGridDataColumn)
            {
                string dataField         = (e.Column as IGridDataColumn).GetActiveDataField();
                List <GridDataItem> list = new List <GridDataItem>();
                switch (dataField)
                {
                case "CustomerID":
                    e.ListBox.DataSource = y.Data.Select(x => new { text = x.CustomerID == "\0" ? "(blank)" : x.CustomerID, value = x.CustomerID }).Distinct().OrderBy(x => x.text);
                    break;

                case "CompanyName":
                    e.ListBox.DataSource = y.Data.Select(x => new { text = x.CompanyName == "\0" ? "(blank)" : x.CompanyName, value = x.CompanyName }).Distinct().OrderBy(x => x.text);
                    break;

                case "GrowMeth":
                    e.ListBox.DataSource = y.Data.Select(x => new { text = x.ContactName == "\0" ? "(blank)" : x.ContactName, value = x.ContactName }).Distinct().OrderBy(x => x.text);
                    break;

                case "TypeCode":
                    e.ListBox.DataSource = y.Data.Select(x => new { text = x.ContactTitle == "\0" ? "(blank)" : x.ContactTitle, value = x.ContactTitle }).Distinct().OrderBy(x => x.text);
                    break;
                }
                e.ListBox.DataTextField  = "text";
                e.ListBox.DataValueField = "value";
                e.ListBox.DataBind();
            }
        }
        protected void ReportGrid_FilterCheckListItemsRequested(object sender, Telerik.Web.UI.GridFilterCheckListItemsRequestedEventArgs e)
        {
            string DataField = (e.Column as IGridDataColumn).GetActiveDataField();

            e.ListBox.DataSource     = Data.GetDataFromSql(sql, DataField, DB);
            e.ListBox.DataKeyField   = DataField;
            e.ListBox.DataTextField  = DataField;
            e.ListBox.DataValueField = DataField;
            e.ListBox.DataBind();
        }