protected void WorkQueueItemsGrid_OnNeedDataSource(Object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            if (!e.IsFromDetailTable)
            {
                // MASTER TABLE VIEW NEEDS DATA SOURCE

                switch (e.RebindReason)
                {
                case Telerik.Web.UI.GridRebindReason.InitialLoad:

                case Telerik.Web.UI.GridRebindReason.ExplicitRebind:

                case Telerik.Web.UI.GridRebindReason.PostBackEvent:                 // ALL DATA IS PRE-LOADED

                case Telerik.Web.UI.GridRebindReason.PostbackViewStateNotPersisted: // ALL DATA IS PRE-LOADED


                    Int64 filteredItems = 0;

                    Int64 totalItems = 0;

                    Int32 filterNodeState;


                    List <Mercury.Server.Application.DataFilterDescriptor> filters = new List <Mercury.Server.Application.DataFilterDescriptor> ();

                    filters.Add(MercuryApplication.CreateFilterDescriptor("WorkQueueId", Mercury.Server.Application.DataFilterOperator.IsEqualTo, WorkQueueSelected.Id));


                    totalItems = MercuryApplication.WorkQueueItemsGetCount(filters, false);

                    #region Create Filters from Selections

                    filterNodeState = FilterNodeState("FilterIsCompleted");

                    if (filterNodeState != 1)
                    {
                        filters.Add(MercuryApplication.CreateFilterDescriptor("IsCompleted", Mercury.Server.Application.DataFilterOperator.IsEqualTo, (filterNodeState == 2)));
                    }

                    filterNodeState = FilterNodeState("FilterIsAssigned");

                    if (filterNodeState != 1)
                    {
                        filters.Add(MercuryApplication.CreateFilterDescriptor("IsAssigned", Mercury.Server.Application.DataFilterOperator.IsEqualTo, (filterNodeState == 2)));
                    }

                    filterNodeState = FilterNodeState("FilterHasConstraintDatePassed");

                    if (filterNodeState != 1)
                    {
                        filters.Add(MercuryApplication.CreateFilterDescriptor("HasConstraintDatePassed", Mercury.Server.Application.DataFilterOperator.IsEqualTo, (filterNodeState == 2)));
                    }

                    filterNodeState = FilterNodeState("FilterHasThresholdDatePassed");

                    if (filterNodeState != 1)
                    {
                        filters.Add(MercuryApplication.CreateFilterDescriptor("HasThresholdDatePassed", Mercury.Server.Application.DataFilterOperator.IsEqualTo, (filterNodeState == 2)));
                    }

                    filterNodeState = FilterNodeState("FilterHasDueDatePassed");

                    if (filterNodeState != 1)
                    {
                        filters.Add(MercuryApplication.CreateFilterDescriptor("HasDueDatePassed", Mercury.Server.Application.DataFilterOperator.IsEqualTo, (filterNodeState == 2)));
                    }

                    filterNodeState = FilterNodeState("FilterWithinWorkTimeRestrictions");

                    if (filterNodeState != 1)
                    {
                        filters.Add(MercuryApplication.CreateFilterDescriptor("WithinWorkTimeRestrictions", Mercury.Server.Application.DataFilterOperator.IsEqualTo, (filterNodeState == 2)));
                    }


                    if (FilterNodeState("FilterWorkQueueItemName") == 1)
                    {
                        Telerik.Web.UI.RadComboBox FilterWorkQueueItemNameOperatorSelection = (Telerik.Web.UI.RadComboBox)

                                                                                                  ((Telerik.Web.UI.RadTreeView)BasicFiltersSelection.Items[0].FindControl("BasicFiltersTreeView")).FindNodeByValue("FilterWorkQueueItemName").FindControl("FilterWorkQueueItemNameOperatorSelection");

                        Telerik.Web.UI.RadTextBox FilterWorkQueueItemNameValue = (Telerik.Web.UI.RadTextBox)

                                                                                     ((Telerik.Web.UI.RadTreeView)BasicFiltersSelection.Items[0].FindControl("BasicFiltersTreeView")).FindNodeByValue("FilterWorkQueueItemName").FindControl("FilterWorkQueueItemNameValue");


                        switch (FilterWorkQueueItemNameOperatorSelection.SelectedValue)
                        {
                        case "Contains": filters.Add(MercuryApplication.CreateFilterDescriptor("Name", Mercury.Server.Application.DataFilterOperator.Contains, FilterWorkQueueItemNameValue.Text)); break;

                        case "StartsWith": filters.Add(MercuryApplication.CreateFilterDescriptor("Name", Mercury.Server.Application.DataFilterOperator.StartsWith, FilterWorkQueueItemNameValue.Text)); break;

                        case "EndsWith": filters.Add(MercuryApplication.CreateFilterDescriptor("Name", Mercury.Server.Application.DataFilterOperator.EndsWith, FilterWorkQueueItemNameValue.Text)); break;
                        }
                    }

                    if (FilterNodeState("FilterAssignedToDisplayName") == 1)
                    {
                        Telerik.Web.UI.RadComboBox FilterAssignedToDisplayNameOperatorSelection = (Telerik.Web.UI.RadComboBox)

                                                                                                      ((Telerik.Web.UI.RadTreeView)BasicFiltersSelection.Items[0].FindControl("BasicFiltersTreeView")).FindNodeByValue("FilterAssignedToDisplayName").FindControl("FilterAssignedToDisplayNameOperatorSelection");

                        Telerik.Web.UI.RadTextBox FilterAssignedToDisplayNameValue = (Telerik.Web.UI.RadTextBox)

                                                                                         ((Telerik.Web.UI.RadTreeView)BasicFiltersSelection.Items[0].FindControl("BasicFiltersTreeView")).FindNodeByValue("FilterAssignedToDisplayName").FindControl("FilterAssignedToDisplayNameValue");


                        switch (FilterAssignedToDisplayNameOperatorSelection.SelectedValue)
                        {
                        case "Contains": filters.Add(MercuryApplication.CreateFilterDescriptor("AssignedToUserDisplayName", Mercury.Server.Application.DataFilterOperator.Contains, FilterAssignedToDisplayNameValue.Text)); break;

                        case "StartsWith": filters.Add(MercuryApplication.CreateFilterDescriptor("AssignedToUserDisplayName", Mercury.Server.Application.DataFilterOperator.StartsWith, FilterAssignedToDisplayNameValue.Text)); break;

                        case "EndsWith": filters.Add(MercuryApplication.CreateFilterDescriptor("AssignedToUserDisplayName", Mercury.Server.Application.DataFilterOperator.EndsWith, FilterAssignedToDisplayNameValue.Text)); break;
                        }
                    }
                    #endregion


                    // UPDATE COUNT

                    filteredItems = MercuryApplication.WorkQueueItemsGetCount(WorkQueueViewSelected, filters, false);

                    WorkQueueItemsAvailableCount.Text = filteredItems.ToString() + " / " + totalItems.ToString();

                    WorkQueueItemsGrid.VirtualItemCount = Convert.ToInt32(filteredItems);


                    List <Mercury.Server.Application.DataSortDescriptor> sorts = new List <Server.Application.DataSortDescriptor> ();

                    foreach (Telerik.Web.UI.GridSortExpression currentSortExpression in WorkQueueItemsGrid.MasterTableView.SortExpressions)
                    {
                        switch (currentSortExpression.SortOrder)
                        {
                        case Telerik.Web.UI.GridSortOrder.Ascending:

                        case Telerik.Web.UI.GridSortOrder.Descending:

                            sorts.Add(MercuryApplication.CreateSortDescription(currentSortExpression.FieldName, ((currentSortExpression.SortOrder == Telerik.Web.UI.GridSortOrder.Ascending) ? Mercury.Server.Application.DataSortDirection.Ascending : Mercury.Server.Application.DataSortDirection.Descending)));

                            break;
                        }
                    }


                    Int32 initialRow = (WorkQueueItemsGrid.CurrentPageIndex * WorkQueueItemsGrid.PageSize) + 1;

                    List <Client.Core.Work.WorkQueueItem> workQueueItems = MercuryApplication.WorkQueueItemsGetByViewPage(WorkQueueViewSelected, filters, sorts, initialRow, WorkQueueItemsGrid.PageSize, false);

                    WorkQueueItemsGrid.DataSource = workQueueItems;

                    break;

                default:

                    System.Diagnostics.Debug.WriteLine("Unhandled Master Rebind Reason: " + e.RebindReason);

                    break;
                }
            }

            else   // DETAIL TABLE NEEDS DATA SOURCE

            {
                WorkQueueItemsGrid.MasterTableView.DetailTables[0].DataSource = WorkQueueItemSenders;
            }

            return;
        }