private void FillSearchOperators(string searchField)
        {
            drpdSearchOperators.Items.Clear();

            SPField queryField = list.Fields[new Guid(searchField)];

            drpdSearchOperators.Items.Add(new ListItem(LookupFieldWithPickerHelper.GetResourceString("lookupWithPickerOperatorEquals"), "Eq"));
            drpdSearchOperators.Items.Add(new ListItem(LookupFieldWithPickerHelper.GetResourceString("lookupWithPickerOperatorNotEqual"), "Neq"));

            if (queryField.Type == SPFieldType.Counter || queryField.Type == SPFieldType.Integer ||
                queryField.Type == SPFieldType.Number || queryField.Type == SPFieldType.Currency ||
                queryField.Type == SPFieldType.DateTime)
            {
                drpdSearchOperators.Items.Add(new ListItem(LookupFieldWithPickerHelper.GetResourceString("lookupWithPickerOperatorLessThan"), "Lt"));
                drpdSearchOperators.Items.Add(new ListItem(LookupFieldWithPickerHelper.GetResourceString("lookupWithPickerOperatorLessThanOrEqualTo"), "Leq"));
                drpdSearchOperators.Items.Add(new ListItem(LookupFieldWithPickerHelper.GetResourceString("lookupWithPickerOperatorGreaterThan"), "Gt"));
                drpdSearchOperators.Items.Add(new ListItem(LookupFieldWithPickerHelper.GetResourceString("lookupWithPickerOperatorGreaterThanOrEqualTo"), "Geq"));
            }
            else
            {
                if (queryField.Type != SPFieldType.Boolean && queryField.Type != SPFieldType.DateTime)
                {
                    drpdSearchOperators.Items.Insert(0, new ListItem(LookupFieldWithPickerHelper.GetResourceString("lookupWithPickerOperatorContains"), "Contains"));
                }

                drpdSearchOperators.Items.Insert(1, new ListItem(LookupFieldWithPickerHelper.GetResourceString("lookupWithPickerOperatorBeginsWith"), "BeginsWith"));
            }
        }
        private DataTable GetListTable(string search, string groupName)
        {
            SPField searchField        = list.Fields[new Guid(groupName)];
            SPListItemCollection items = null;

            if (!string.IsNullOrEmpty(search))
            {
                SPQuery query = new SPQuery();

                if (searchField.Type == SPFieldType.DateTime)
                {
                    search = SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Parse(search));
                }

                string valueType = searchField.TypeAsString;
                if (searchField.Type == SPFieldType.Calculated)
                {
                    valueType = "Text";
                }

                query.ViewAttributes = "Scope=\"Recursive\"";
                query.Query          = string.Format("<Where><{0}><FieldRef ID=\"{1}\"/><Value Type=\"{2}\">{3}</Value></{0}></Where>"
                                                     , searchOperator ?? "Eq"
                                                     , searchField.Id.ToString()
                                                     , valueType
                                                     , search);

                items = list.GetItems(query);
            }
            else
            {
                items = list.Items;
            }

            if (items.Count > propertyBag.MaxSearchResults)
            {
                this.PickerDialog.ErrorMessage = LookupFieldWithPickerHelper.GetResourceString("lookupWithPickerSearchResultExceededMessage");
                return(dataTable);
            }

            foreach (SPListItem item in items)
            {
                DataRow row = dataTable.NewRow();
                foreach (DataColumn col in dataTable.Columns)
                {
                    SPField field = item.Fields[new Guid(col.ColumnName)];
                    row[col] = field.GetFieldValueAsText(item[field.Id]);
                }
                dataTable.Rows.Add(row);
            }

            return(dataTable);
        }