Remove Check All Check is not working as expected...

5 posts, 1 answers
  1. Wired_Nerve
    Wired_Nerve avatar
    163 posts
    Member since:
    Oct 2007

    Posted 19 Mar 2013 Link to this post

    PLEASE SEE ATTACHED IMAGE for screen captures...

    I have a bit of code that is called to remove all checked items in various radcomboboxes with checkboxes...

    My code works great to remove their selections, but if they use the check all option and then opt to clear all selections (a button event) all the checked items are unchecked EXCEPT for the check all...

    function clearCheckedItems(combo) {
                for (var i = 0; i < combo.get_items().get_count(); i++) {
                    combo.trackChanges();
                    combo.get_items().getItem(i).set_checked(false);
    // The following code I was hoping to use to clear the checkall box...
                    //var element = combo.get_dropDownElement();
                    //var checkAll = $telerik.$(element).find(".rcbCheckAllItemsCheckBox");
                    //      So what do I need to do at this point to clear the check all checkbox...??
     
                    combo.commitChanges();
                }
            }
  2. Wired_Nerve
    Wired_Nerve avatar
    163 posts
    Member since:
    Oct 2007

    Posted 21 Mar 2013 Link to this post

    I am still looking for a way to remove the check all check from the radcombo via an Refresh button on the page...

  3. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1968 posts

    Posted 22 Mar 2013 Link to this post

    Hello,

    Please find attached a sample project that implements very similar scenario - clicking on the submit button will clear all RadComboBox items including the "Check All" item. Here you may watch a video that demonstrates the application behavior at my side. Please could you clarify what exactly is different in your scenario  in order to replicate that issue locally and be more helpful.


    Regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  4. Wired_Nerve
    Wired_Nerve avatar
    163 posts
    Member since:
    Oct 2007

    Posted 22 Mar 2013 Link to this post

    I tried using the exact approach you have and it did not work either...
    User Story:
    1. In a RadComboBox (with a empty message Please select: ) are several checkbox options, plus a check all...
    ----- The page has several Radcomboboxes

    2. The user selects Check All
    3. Performs a filter
    4. Decides to clear their filters and clicks a image button linked to a javascript to clear all controls on the page of selected or enter values.

    The radComboBoxes clear all the selected items EXCEPT the Check All box is stil selected.

    Below is the entire source for the page...

    <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Nav.Master" AutoEventWireup="true"
        CodeBehind="ReconcileAdministrative.aspx.cs" Inherits="TIPWebIT.AuditManagement.ReconcileAdministrative" %>
     
    <%@ MasterType TypeName="TIPWebCommon.MasterPages.Nav" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
        <link href="../App_Themes/TIPWeb/FormSets.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery-1.8.2.min.js") %>"></script>
        <script type="text/javascript">
            //=====================================================
            //==                    GLOBAL VARIALBES
            //==---------------------------------------------------
            //===   The global variables are used by the ajax
            //==    method and other helper javascript methods
            //=====================================================
            var Action = '';
            var Tag = '';
            var AuditDetailUID = '';
            var AuditDetailRoomUID = '';
            var comboAction = '';
            //=======================
            //=====================================================
            //==        JQUERY DOCUMENT READY EVENTS
            //-----------------------------------------------------
            //===   Use this section for any code you need to run
            //===   any time the page loads for the first time
            //===   or any event that needs to fire code via jquery
            //=====================================================
            $(document).ready(function () {
                // put all your jQuery goodness in here.
                var isPost = $('head').data('isPostback');
                if (isPost != "true") {
                    // Prepare the page on first load to hide controls
                    $("#PriceBetween").hide();
                    $("#LastScanDateBetween").hide();
                    $("#AuditDateAfterBetween").hide();
     
                }
            });
     
     
     
     
     
            //================================================
            //==    AJAX MAANGER CLIENT CODE
            //================================================
            //==    Register events in the page_load
            //==    on the server side
            //==  A great read:
            //==----------------------------------------------
            //==    Using this technique is much easier than
            //==    figuring out the correct ajax settings
            //==    ecpecially if you don't want to wrap the
            //==    entire page in a update panel.  Which I
            //==    don't want to do so I can maintain
            //==    client side control state via javascript.
            //==   
            //================================================
            function ucOnResponseEnd(sender, eventArgs) {
     
                if (eventArgs._eventTarget.indexOf("ImageButtonGo") > 0) {
                    ajax_toggleItem();
                }
            }
     
     
            //====================================================
            //===       RADWINDOW MODAL EVENTS
            //====================================================
            //==    I used this method instead of the fake modal
            //==    because it is vastly cleaner on the markup side
            //==    Plus the benefits of having it fully cross
            //==    browser tested by telerik and all the various
            //==    client side events they offer...
            //====================================================
     
            //====================================================
            //==    Save Changes and reset UI by reloading grid
            //====================================================
            function CloseModal() {
     
                postAction();
     
                //====================================================
                //===   Close the RadWindow
                //====================================================
                var oWnd = window.$find("<%= RadWindowActionNotes.ClientID %>");
                oWnd.close();
                $("#ModalNotes").val('');
                //====================================================
                //===   Rebind the RadGrid
                //===       We can not rebind if we decide to use javascript to hide the combo...
                //===       Then we can actually update the ROW's info to reflect the actual change, might
                //===       be easier to rebind.
                //====================================================
                //            var masterTable = $find("<%= RadGridAudits.ClientID %>").get_masterTableView();
                //            masterTable.rebind();
     
            }
     
            function CancelModal() {
                //====================================================
                //===   Clear the RadWindows Notes field of values
                //====================================================
                $("#ModalNotes").val('');
     
                //====================================================
                //===   Close the RadWindow
                //====================================================
                var oWnd = $find("<%= RadWindowActionNotes.ClientID %>");
                oWnd.close();
     
                //====================================================
                //===   Rebind the RadGrid
                //====================================================
                var masterTable = $find("<%= RadGridAudits.ClientID %>").get_masterTableView();
                masterTable.rebind();
     
            }
     
            function getControl(rowIndex, comboAction) {
                var masterTable = $find("<%=RadGridAudits.ClientID%>").get_masterTableView();
                // var datePicker = masterTable.get_dataItems()[0].findControl('rtpTime'); // Here 0 represents the index of crow in editmode
                //  var selectedItems = MasterTable.get_selectedItems();
                // var LabelTagAuditState = masterTable.get_dataItems()[rowIndex].findControl('LabelTagAuditState');
     
                var selectedRows = masterTable.get_selectedItems();
                for (var i = 0; i < selectedRows.length; i++) {
                    var row = selectedRows[i];
                    masterTable.get_dataItems()[rowIndex].findElement('clientActionLabel').innerText = comboAction;
                    masterTable.get_dataItems()[rowIndex].findElement('clientActionLabel').style.display = "block";
     
     
                    //                var cell = MasterTable.getCellByColumnUniqueName(row, "CategoryID");
                    //                var myControl = row.findControl('LabelTagAuditState');
                    //                var imageState = masterTable.get_dataItems()[rowIndex].findElement('ImageState').src = '';
                    //                masterTable.get_dataItems()[rowIndex].findElement('ImageState').style.display = "none";
     
                    //                masterTable.get_dataItems()[rowIndex].findElement('LabelTagAuditState').innerText = '';
     
     
                }
     
     
            }
     
            function select(rowIndex, comboAction) {
                var grid = $find("<%=RadGridAudits.ClientID %>");
                var MasterTable = grid.get_masterTableView();
                MasterTable.get_dataItems()[rowIndex].set_selected(true);
                // Get edit controls on this selected row to reflect changes
                getControl(rowIndex, comboAction);
     
            }
     
            function deselect() {
                var masterTable = $find("<%= RadGridAudits.ClientID %>").get_masterTableView();
                var row = masterTable.get_dataItems();
                for (var i = 0; i < row.length; i++) {
                    masterTable.get_dataItems()[i].set_selected(false);
                }
            }
     
            //============================================================
            //==    A generic function that is used by the search type
            //==    combo boxes to show or hide between ranges
            //============================================================
            function BetweenChanged(sender, eventArgs) {
                // Determine who the sender is..
                //Reveal the between section
     
     
                var betweenCombo = sender.get_id();
                var optionSelected = eventArgs.get_item().get_value();
     
                if (betweenCombo == "RadComboBoxPriceSearchType") {
                    if (optionSelected != "between") {
                        $("#PriceBetween").hide(); // addClass("DisplayNone");
                        //Clear the value
                        window.$find("<%= RadNumericTextBoxPriceBetween.ClientID %>").clear();
                        return false;
                    }
                    else if (optionSelected == "between") {
                        $("#PriceBetween").show(); // removeClass("DisplayNone");
                        return false;
                    }
                }
     
                //============================================================
                //===   Hide / Show
                //============================================================
     
                if (betweenCombo == "RadComboBoxLastScanDateSearchType") {
                    if (optionSelected != "between") {
                        $("#LastScanDateBetween").hide(); // addClass("DisplayNone");
                        //Clear a selection
                        window.$find("<%= RadDatePickerLastScanDateBetween.ClientID %>").clear();
                        return false;
                    }
                    else if (optionSelected == "between") {
                        $("#LastScanDateBetween").show(); // removeClass("DisplayNone");
                        return false;
                    }
                }
     
     
                if (betweenCombo == "RadComboBoxAuditDateAfterSearchType") {
                    if (optionSelected != "between") {
                        $("#AuditDateAfterBetween").hide(); // addClass("DisplayNone");
                        //Clear a selection
                        window.$find("<%= RadDatePickerAuditDateAfterBetween.ClientID %>").clear();
                        return false;
                    }
                    else if (optionSelected == "between") {
                        $("#AuditDateAfterBetween").show(); // removeClass("DisplayNone");
                        return false;
                    }
                }
     
     
                return false;
     
            }
     
     
            function onSelectedIndexChanged(sender, eventArgs) {
     
                //=====================================================
                //===   Get the row index this event occured on
                //=====================================================
     
                // First deselect any rows
                deselect();
                // Now Select the active row
                var rowIndex = sender.get_element().parentNode.parentNode.rowIndex - 1;
     
     
     
     
                //====================================================
                //===   Fires when a user changes a radcombo box in
                //===   the RadGrid.
                //====================================================
                var selectedItem = eventArgs.get_item();
                select(rowIndex, selectedItem.get_text());
     
     
                comboAction = sender.get_id();
     
                sender.set_visible(false);
                //            var uniqueID = sender._uniqueId;
                //            $('#' + uniqueID +'').hide();
     
                //====================================================
                //===   Get the needed values and parse
                //====================================================
                Action = selectedItem.get_text();
                //====================================================
                //===   Get AuditDetailUIDAndTag and split by |
                //====================================================
                var AuditSplit = selectedItem.get_value().split("|");
     
                AuditDetailUID = AuditSplit[0];
                AuditDetailRoomUID = AuditSplit[1];
                Tag = AuditSplit[2];
     
                //====================================================
                //===   Show the local RadWidow to the user
                //====================================================
                var oWnd = $find("<%= RadWindowActionNotes.ClientID %>");
                oWnd.set_title(Action);
                //  oWnd.center();
                //  oWnd.setActive();
                //  oWnd.set_Modal(true);
                if (Action == "No Action") {
                    $("#ModalNotes").val("No Action");
                    postAction();
                    return false;
                }
                oWnd.show();
     
                return false;
     
            }
     
     
            function postAction() {
                //====================================================
                //===   This event fires when the user saves the
                //===   message for a selected action (radgrid combo)
                //===
                //===   This is a jquery ajax call to a server side
                //===   web method.
                //====================================================
     
     
                //====================================================
                //===   Get the user entered message
                //====================================================
                var message = $("#ModalNotes").val();
     
                //====================================================
                //===   Ensure the document is fully loaded before
                //===   firing off the jquery ajax command
                //====================================================
     
                $(document).ready(function () { // Begin Document Ready
     
                    //====================================================
                    //===   The baseUrl variable is defined in the
                    //===   NavMaster page source, not code behind
                    //====================================================
                    var url = baseUrl + "AuditManagement/ReconcileAdministrative.aspx/ChangeTagStatus";
     
                    //====================================================
                    //===   This ajax call post the data to the server side
                    //===   static web method.
                    //===   The parameters MUST match the webmethod exactly
                    //====================================================
     
                    var parameters = new Object();
                    parameters.action = Action;
                    parameters.tag = Tag;
                    parameters.auditDetailUID = AuditDetailUID;
                    parameters.auditDetailRoomUID = AuditDetailRoomUID;
                    parameters.message = message;
     
     
                    //====================================================
                    //===   Use the JSON.Stringify to seriallize the
                    //===   the object in this format:
                    //===       {"Action":"Stolen","Tag":"T9222","AuditDetailUID":"3","AuditDetailRoomUID":"990","Message":"asdfasdfsdf"}
                    //===   Great read:
                    //=====================================================
     
     
                    $.ajax({
                        type: "POST",
                        url: url,
                        data: JSON.stringify(parameters),
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (msg) {
                            if (msg.d.indexOf("Error") > 0) {
                                alert(removeHTMLTags(msg.d));
                                var masterTable = window.$find("<%= RadGridAudits.ClientID %>").get_masterTableView();
                                masterTable.rebind();
     
                            }
     
                        }
                    });
                });          // End Document Ready
     
            }
     
     
            function removeHTMLTags(html) {
                var strTagStrippedText = html.replace(/<\/?[^>]+(>|$)/g, "");
                return strTagStrippedText;
     
            }
     
     
            //====================================================
            //===   Range Code
            //====================================================
            function ShowLastScanDateRange() {
                var lastScanDateCombo = $('#LastScanDateCombo').attr('checked');
                if (lastScanDateCombo) {
                    alert("Checked");
                }
     
            }
     
            //====================================================
            //===   Search Box code
            //====================================================
     
     
            //====================================================
            //===   This function is called afte the ImageButtonGo
            //==    javascript click event occurs and the grid has
            //==    finished it's post and update events.
            //==      The primary reason I am collapsing the panel
            //==    control here is to give the grid time to execute
            //==    it's dat request and have the update panel
            //==    spinner graphic look better instead of not
            //==    having the spinner on top of the grid as it
            //==    gets it's data. 
            //====================================================
            function ajax_toggleItem() {
                var panelBar = $find("<%=AuditFilterPanel.ClientID%>");
                if (panelBar != null) {
                    panelBar.findItemByText("Search Inventory Audits Filters").collapse();
                }
     
                //            if (item) {
                //                if (!item.get_expanded()) {
                //                    item.expand();
                //                }
                //                else {
                //                    item.collapse();
                //                }
                //            }
                //            else {
                //                alert("Item with text '" + text + "' not found.");
                //            }
            }
     
            //====================================================
            //===   Search Box code
            //====================================================
     
     
     
            function ValidateFilters() {
                var count = 0;
                var isValid = false;
     
     
                var RadComboTagAuditState = $find("<%= RadComboTagAuditState.ClientID %>");
                count = RadComboTagAuditState.get_checkedItems();
                if (count == 0) {
                    isValid = false;
                } else {
     
                    return true;
                }
     
     
     
                var RadDatePickerAuditDateAfter = $find("<%= RadDatePickerAuditDateAfter.ClientID %>");
     
                if (isValid == false && RadDatePickerAuditDateAfter.isEmpty()) {
                    isValid = false;
                }
                else {
     
                    return true;
                }
     
                var RadComboRoomAuditStatus = $find("<%= RadComboRoomAuditStatus.ClientID %>");
                count = RadComboRoomAuditStatus.get_checkedItems();
                if (isValid == false && count == 0) {
                    isValid = false;
                }
                else {
     
                    return true;
                }
     
                var RadDatePickerLastScanDate = $find("<%= RadDatePickerLastScanDate.ClientID %>");
                if (isValid == false && RadDatePickerLastScanDate.isEmpty()) {
                    isValid = false;
                }
                else {
     
                    return true;
                }
     
                var RadComboSiteName = $find("<%=RadComboSiteName.ClientID %>");
                count = RadComboSiteName.get_checkedItems();
                if (isValid == false && count == 0) {
                    isValid = false;
                }
                else {
     
                    return true;
                }
     
                var RadComboExpectedLocationType = $find("<%= RadComboExpectedLocationType.ClientID %>");
                count = RadComboExpectedLocationType.get_checkedItems();
                if (isValid == false && count == 0) {
                    isValid = false;
                }
                else {
     
                    return true;
                }
     
                var RadComboHardwareType = $find("<%= RadComboHardwareType.ClientID %>");
                count = RadComboHardwareType.get_checkedItems();
                if (isValid == false && count == 0) {
                    isValid = false;
                } else {
     
                    isValid = true;
                }
     
                var RadNumericTextBoxPrice = $find("<%= RadNumericTextBoxPrice.ClientID %>");
                if (isValid == false && RadNumericTextBoxPrice.isEmpty()) {
                    isValid = false;
                } else {
     
                    isValid = true;
                }
     
                if (isValid == false) {
                    alert("At least one filter must be used.");
     
                    return false;
                }
     
                return true;
            }
     
            function clearCheckedItems(combo) {
     
                for (var i = 0; i < combo.get_items().get_count(); i++) {
                    combo.get_items().getItem(i).set_checked(false);
                }
            }
     
            function ClearFilters() {
     
               // location.reload(false);  //TODO: Remove once telerik answers query....
     
     
     
                var RadComboTagAuditState = $find("<%= RadComboTagAuditState.ClientID %>");
     
                for (var i = 0; i < RadComboTagAuditState.get_items().get_count(); i++) {
                    RadComboTagAuditState.get_items().getItem(i).set_checked(false);
                }
     
     
               // clearCheckedItems(RadComboTagAuditState);
     
     
                var RadComboExpectedLocationType = $find("<%= RadComboExpectedLocationType.ClientID %>");
              //  RadComboExpectedLocationType.clearSelection();
                  clearCheckedItems(RadComboExpectedLocationType);
                 
     
                var RadComboRoomAuditStatus = $find("<%= RadComboRoomAuditStatus.ClientID %>");
                RadComboRoomAuditStatus.clearSelection();
                clearCheckedItems(RadComboRoomAuditStatus);
     
                var RadComboHardwareType = $find("<%= RadComboHardwareType.ClientID %>");
                RadComboHardwareType.clearSelection();
                clearCheckedItems(RadComboHardwareType);
     
                var RadComboSiteName = $find("<%=RadComboSiteName.ClientID %>");
                RadComboSiteName.clearSelection();
                clearCheckedItems(RadComboSiteName);
     
                //=========================
                //== Between Hide Show
                //==========================
                var RadDatePickerAuditDateAfter = $find("<%= RadDatePickerAuditDateAfter.ClientID %>");
                RadDatePickerAuditDateAfter.clear();
                var RadDatePickerAuditDateAfterBetween = $find("<%= RadDatePickerAuditDateAfterBetween.ClientID %>");
                RadDatePickerAuditDateAfterBetween.clear();
                //$("#AuditDateAfterBetween").hide();
     
                //Reset combo to toEqual
                var RadComboBoxAuditDateAfterSearchType = $find("<%= RadComboBoxAuditDateAfterSearchType.ClientID %>");
                RadComboBoxAuditDateAfterSearchType.findItemByValue("equalto").select();
     
     
                var RadDatePickerLastScanDate = $find("<%= RadDatePickerLastScanDate.ClientID %>");
                RadDatePickerLastScanDate.clear();
                var RadDatePickerLastScanDateBetween = $find("<%= RadDatePickerLastScanDateBetween.ClientID %>");
                RadDatePickerLastScanDateBetween.clear();
                //$("#LastScanDateBetween").hide();
     
                //Reset combo to toEqual
                var RadComboBoxLastScanDateSearchType = $find("<%= RadComboBoxLastScanDateSearchType.ClientID %>");
                RadComboBoxLastScanDateSearchType.findItemByValue("equalto").select();
     
     
                var RadNumericTextBoxPrice = $find("<%= RadNumericTextBoxPrice.ClientID %>");
                RadNumericTextBoxPrice.clear();
                var RadNumericTextBoxPriceBetween = $find("<%= RadNumericTextBoxPriceBetween.ClientID %>");
                RadNumericTextBoxPriceBetween.clear();
                // $("#PriceBetween").hide();
                //Reset combo to toEqual
                var RadComboBoxPriceSearchType = $find("<%= RadComboBoxPriceSearchType.ClientID %>");
                RadComboBoxPriceSearchType.findItemByValue("equalto").select();
     
     
     
     
                //HideGrid();
     
            }
     
     
            function HideGrid() {
                var radGrid = $find("<%= RadGridAudits.ClientID%>");
                radGrid.set_visible(false);
     
            }
     
     
            function clearRadDatePickerAuditDateAfter() {
                var datepicker = $find("<%= RadDatePickerAuditDateAfter.ClientID %>");
                datepicker.clear();
            }
            function clearRadDatePickerAuditDateAfterBetween() {
                var datepicker = $find("<%= RadDatePickerAuditDateAfterBetween.ClientID %>");
                datepicker.clear();
            }
            function clearRadDatePickerLastScanDate() {
                var datepicker = $find("<%= RadDatePickerLastScanDate.ClientID %>");
                datepicker.clear();
            }
            function clearRadDatePickerLastScanDateBetween() {
                var datepicker = $find("<%= RadDatePickerLastScanDateBetween.ClientID %>");
                datepicker.clear();
            }
     
     
        </script>
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <input type="hidden" id="clientSideIsPostBack" runat="server" clientidmode="Static"
            name="clientSideIsPostBack" />
        <telerik:RadWindow runat="server" ID="RadWindowActionNotes" VisibleOnPageLoad="False"
            Title="Action Notes" Skin="Default" Modal="True" Behaviors="Move, Reload">
            <ContentTemplate>
                <style type="text/css">
                    /* Allows radComboBox dropdowns to expand horizontally
       rather than use a scrollbar */
                    @media \0screen
                    {
                        .rcbAutoWidth .rcbList
                        {
                            min-width: 142px;
                        }
                    }
                </style>
                <div style="margin: 10px;">
                    <div style="text-align: left;">
                        Status notes:
                    </div>
                    <div style="text-align: center; height: 400px">
                        <asp:TextBox runat="server" Width="100%" Height="100%" ClientIDMode="Static" ID="ModalNotes"
                            MaxLength="500" Columns="25" TextMode="MultiLine" CausesValidation="False"></asp:TextBox>
                    </div>
                    <div id="SaveActions" style="margin-top: 25px;">
                        <asp:ImageButton runat="server" ClientIDMode="Static" ID="ModalOk" ToolTip="Save notes"
                            ImageUrl="../App_Themes/TIPWeb/Images/Save.gif" OnClientClick="CloseModal(); return false;"
                            CausesValidation="False" /> 
                        <asp:ImageButton runat="server" ClientIDMode="Static" ID="ImageButton1" ToolTip="Cancel notes"
                            ImageUrl="../App_Themes/TIPWeb/Images/Cancel.gif" OnClientClick="CancelModal(); return false;" />
                    </div>
                </div>
            </ContentTemplate>
        </telerik:RadWindow>
        <telerik:RadPanelBar runat="server" ID="AuditFilterPanel" ClientIDMode="Static" Width="100%">
            <Items>
                <telerik:RadPanelItem runat="server" Text="Search Inventory Audits Filters" Expanded="True"
                    ImageUrl="~/App_Themes/TIPWEB/Images/filter_16.gif">
                    <ContentTemplate>
                        <asp:Panel class="expand" runat="server" DefaultButton="ImageButtonGo">
                            <!-- Filters Begin -->
                            <table>
                                <tr>
                                    <!-- Left Column -->
                                    <td>
                                        <table>
                                            <tr>
                                                <td class="childCaption">
                                                    <label>
                                                        Tag Audit State:</label>
                                                </td>
                                                <td class="childValue">
                                                    <telerik:RadComboBox runat="server" ID="RadComboTagAuditState" CheckBoxes="true"
                                                        EnableCheckAllItemsCheckBox="true" Skin="Default" EmptyMessage=" Please select:"
                                                        NoWrap="True">
                                                    </telerik:RadComboBox>
                                                </td>
                                            </tr>
                                        </table>
                                        <table>
                                            <tr>
                                                <td class="childCaption">
                                                    <label>
                                                        Expected Location Type:</label>
                                                </td>
                                                <td class="childValue">
                                                    <telerik:RadComboBox runat="server" ID="RadComboExpectedLocationType" CheckBoxes="true"
                                                        NoWrap="True" EnableCheckAllItemsCheckBox="true" EmptyMessage=" Please select:">
                                                    </telerik:RadComboBox>
                                                </td>
                                            </tr>
                                        </table>
                                        <table>
                                            <tr>
                                                <td class="childCaption">
                                                    <label>
                                                        Room Audit Status:</label>
                                                </td>
                                                <td class="childValue">
                                                    <telerik:RadComboBox runat="server" ID="RadComboRoomAuditStatus" CheckBoxes="true"
                                                        NoWrap="True" EnableCheckAllItemsCheckBox="true" EmptyMessage=" Please select:">
                                                    </telerik:RadComboBox>
                                                </td>
                                            </tr>
                                        </table>
                                        <table>
                                            <tr>
                                                <td class="childCaption">
                                                    <label>
                                                        Hardware Type:</label>
                                                </td>
                                                <td class="childValue">
                                                    <telerik:RadComboBox runat="server" ID="RadComboHardwareType" CheckBoxes="true" EnableCheckAllItemsCheckBox="true"
                                                        NoWrap="True" DataValueField="statusID" EmptyMessage=" Please select:" DropDownWidth="200px"
                                                        MaxHeight="450px">
                                                    </telerik:RadComboBox>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <!-- Right Column -->
                                    <td>
                                        <table>
                                            <tr>
                                                <td class="childCaption">
                                                    <label>
                                                        Site Name:</label>
                                                </td>
                                                <td class="childValue">
                                                    <telerik:RadComboBox runat="server" ID="RadComboSiteName" CheckBoxes="true" EnableCheckAllItemsCheckBox="true"
                                                        DropDownWidth="250px" EmptyMessage=" Please select:" MaxHeight="450px">
                                                    </telerik:RadComboBox>
                                                </td>
                                            </tr>
                                        </table>
                                        <table>
                                            <tr>
                                                <td class="childCaption">
                                                    <label>
                                                        Audit Date After:</label>
                                                </td>
                                                <td class="childValue">
                                                    <telerik:RadComboBox runat="server" ID="RadComboBoxAuditDateAfterSearchType" Width="95px"
                                                        ClientIDMode="Static" OnClientSelectedIndexChanged="BetweenChanged">
                                                        <Items>
                                                            <telerik:RadComboBoxItem runat="server" Text="Equal To" Value="equalto" />
                                                            <telerik:RadComboBoxItem runat="server" Text="Greater Than" Value="greaterthan" />
                                                            <telerik:RadComboBoxItem runat="server" Text="Less Than" Value="lessthan" />
                                                            <telerik:RadComboBoxItem runat="server" Text="Between" Value="between" />
                                                        </Items>
                                                    </telerik:RadComboBox>
                                                      
                                                    <telerik:RadDatePicker ID="RadDatePickerAuditDateAfter" runat="server" EnableTyping="False"
                                                        FocusedDate="2012-01-01" MinDate="2010-01-01" TabIndex="9" Culture="en-US" Enabled="True">
                                                        <Calendar ID="Calendar1" runat="server" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                                                            ViewSelectorText="x">
                                                        </Calendar>
                                                        <DateInput ID="DateInput1" runat="server" DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy"
                                                            ReadOnly="True" TabIndex="9">
                                                        </DateInput>
                                                        <DatePopupButton ImageUrl="" HoverImageUrl="" TabIndex="9"></DatePopupButton>
                                                    </telerik:RadDatePicker>
                                                    <!-- Clear Selected Date -->
                                                    <input id="ImageAuditDateAfter" style="vertical-align: middle;" type="image" value="Clear"
                                                        src="../App_Themes/TIPWeb/Images/Reset_16.gif" onclick="clearRadDatePickerAuditDateAfter(); return false;" />
                                                    <span runat="server" clientidmode="Static" id="AuditDateAfterBetween"><span style="height: 25px;
                                                        vertical-align: middle"> AND </span>
                                                        <telerik:RadDatePicker ID="RadDatePickerAuditDateAfterBetween" runat="server" EnableTyping="False"
                                                            FocusedDate="2012-01-01" MinDate="2010-01-01" TabIndex="9" Culture="en-US" Enabled="True">
                                                            <Calendar ID="Calendar4" runat="server" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                                                                ViewSelectorText="x">
                                                            </Calendar>
                                                            <DateInput ID="DateInput4" runat="server" DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy"
                                                                ReadOnly="True" TabIndex="9">
                                                            </DateInput>
                                                            <DatePopupButton ImageUrl="" HoverImageUrl="" TabIndex="9"></DatePopupButton>
                                                        </telerik:RadDatePicker>
                                                        <input id="ImageResetAuditDateAfterBetween" style="vertical-align: middle;" type="image"
                                                            value="Clear" src="../App_Themes/TIPWeb/Images/Reset_16.gif" onclick="clearRadDatePickerAuditDateAfterBetween(); return false;" />
                                                    </span>
                                                </td>
                                            </tr>
                                        </table>
                                        <table>
                                            <tr>
                                                <td class="childCaption">
                                                    <label>
                                                        Last Scan Date:</label>
                                                </td>
                                                <td class="childValue">
                                                    <telerik:RadComboBox runat="server" ID="RadComboBoxLastScanDateSearchType" Width="95px"
                                                        ClientIDMode="Static" OnClientSelectedIndexChanged="BetweenChanged">
                                                        <Items>
                                                            <telerik:RadComboBoxItem runat="server" Text="Equal To" Value="equalto" />
                                                            <telerik:RadComboBoxItem runat="server" Text="Greater Than" Value="greaterthan" />
                                                            <telerik:RadComboBoxItem runat="server" Text="Less Than" Value="lessthan" />
                                                            <telerik:RadComboBoxItem runat="server" Text="Between" Value="between" />
                                                        </Items>
                                                    </telerik:RadComboBox>
                                                     <telerik:RadDatePicker ID="RadDatePickerLastScanDate" runat="server" EnableTyping="False"
                                                        FocusedDate="2012-01-01" MinDate="2010-01-01" TabIndex="9" CssClass="PreferenceCalendar"
                                                        Culture="en-US" Enabled="True">
                                                        <Calendar ID="Calendar2" runat="server" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                                                            ViewSelectorText="x">
                                                        </Calendar>
                                                        <DateInput ID="DateInput2" runat="server" DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy"
                                                            ReadOnly="True" TabIndex="9">
                                                        </DateInput>
                                                        <DatePopupButton ImageUrl="" HoverImageUrl="" TabIndex="9"></DatePopupButton>
                                                    </telerik:RadDatePicker>
                                                    <input id="ImageLastScanDate" style="vertical-align: middle;" type="image" value="Clear"
                                                        src="../App_Themes/TIPWeb/Images/Reset_16.gif" onclick="clearRadDatePickerLastScanDate(); return false;" />
                                                    <span runat="server" clientidmode="Static" id="LastScanDateBetween"><span style="height: 25px;
                                                        vertical-align: middle"> AND </span>
                                                        <telerik:RadDatePicker ID="RadDatePickerLastScanDateBetween" runat="server" EnableTyping="False"
                                                            FocusedDate="2012-01-01" MinDate="2010-01-01" TabIndex="9" CssClass="PreferenceCalendar"
                                                            Culture="en-US" Enabled="True">
                                                            <Calendar ID="Calendar3" runat="server" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                                                                ViewSelectorText="x">
                                                            </Calendar>
                                                            <DateInput ID="DateInput3" runat="server" DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy"
                                                                ReadOnly="True" TabIndex="9">
                                                            </DateInput>
                                                            <DatePopupButton ImageUrl="" HoverImageUrl="" TabIndex="9"></DatePopupButton>
                                                        </telerik:RadDatePicker>
                                                        <input id="ImageLastScanDateBetween" style="vertical-align: middle;" type="image"
                                                            value="Clear" src="../App_Themes/TIPWeb/Images/Reset_16.gif" onclick="clearRadDatePickerLastScanDateBetween(); return false;" />
                                                    </span>
                                                </td>
                                            </tr>
                                        </table>
                                        <table>
                                            <tr>
                                                <td class="childCaption">
                                                    <label>
                                                        Price:</label>
                                                </td>
                                                <td class="childValue" style="white-space: nowrap;">
                                                    <telerik:RadComboBox runat="server" ID="RadComboBoxPriceSearchType" Width="95px"
                                                        ClientIDMode="Static" OnClientSelectedIndexChanged="BetweenChanged">
                                                        <Items>
                                                            <telerik:RadComboBoxItem runat="server" Text="Equal To" Value="equalto" />
                                                            <telerik:RadComboBoxItem runat="server" Text="Greater Than" Value="greaterthan" />
                                                            <telerik:RadComboBoxItem runat="server" Text="Less Than" Value="lessthan" />
                                                            <telerik:RadComboBoxItem runat="server" Text="Between" Value="between" />
                                                        </Items>
                                                    </telerik:RadComboBox>
                                                     <telerik:RadNumericTextBox ID="RadNumericTextBoxPrice" runat="server" AllowOutOfRangeAutoCorrect="False"
                                                        EmptyMessage="Enter a dollar amount." MaxValue="999999999" MinValue="0" Type="Currency"
                                                        ValidationGroup="Second" Width="140px">
                                                    </telerik:RadNumericTextBox>
                                                    <span runat="server" clientidmode="Static" id="PriceBetween"><span style="height: 20px;
                                                        vertical-align: middle"> AND </span>
                                                        <telerik:RadNumericTextBox ID="RadNumericTextBoxPriceBetween" runat="server" AllowOutOfRangeAutoCorrect="False"
                                                            EmptyMessage="Enter a dollar amount." EnableTheming="True" MaxValue="999999999"
                                                            MinValue="0" Type="Currency">
                                                        </telerik:RadNumericTextBox>
                                                    </span>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <!-- Filters End -->
                                        <div class="formSetActionFooter">
                                            <asp:ImageButton ID="ImageButtonReset" ImageUrl="~/App_Themes/TIPWEB/Images/Reset.gif"
                                                runat="server" AlternateText="Reset" ToolTip="Reset filters" Visible="True" TabIndex="17"
                                                OnClientClick="ClearFilters(); return false;"></asp:ImageButton
                                            <asp:ImageButton ID="ImageButtonGo" ImageUrl="~/App_Themes/TIPWEB/Images/go.gif"
                                                runat="server" AlternateText="Apply Filter(s)" ToolTip="Apply Filter(s)" Visible="True"
                                                TabIndex="17" OnClick="ImageButtonGo_Click" OnClientClick="return ValidateFilters();">
                                            </asp:ImageButton>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </ContentTemplate>
                </telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelBar>
        <%--<telerik:RadAjaxPanel runat="server" LoadingPanelID="RadAjaxLoadingPanel1" HorizontalAlign="NotSet">--%>
        <telerik:RadGrid ID="RadGridAudits" runat="server" AllowPaging="True" AllowSorting="True"
            GridLines="None" AutoGenerateColumns="False" OnItemCreated="RadGridAudits_ItemCreated"
            OnItemDataBound="RadGridAudits_ItemDataBound" OnNeedDataSource="RadGridAudits_NeedDataSource"
            Visible="True" CellSpacing="0">
            <%--  <ClientSettings>
                    <ClientEvents OnRowClick="ChildRowClick" />
                </ClientSettings>--%>
            <ClientSettings EnablePostBackOnRowClick="False">
                <Selecting EnableDragToSelectRows="False" AllowRowSelect="False" />
            </ClientSettings>
            <MasterTableView DataKeyNames="Tag, auditDetailUID, auditDetailRoomUID">
                <NoRecordsTemplate>
                    <label>
                        Results Found</label>
                </NoRecordsTemplate>
                <CommandItemSettings ExportToPdfText="Export to PDF" />
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridTemplateColumn DataField="TagAuditState" HeaderText="Audit State" SortExpression="TagAuditState"
                        UniqueName="TagAuditState">
                        <ItemTemplate>
                            <asp:Image ID="ImageState" runat="server" />
                            <asp:Label ID="LabelTagAuditState" runat="server" SkinID="EditForms" Text='<%# Eval("TagAuditState") %>' />
                            <asp:HiddenField runat="server" ID="hiddenFieldActionTakenUID" Value='<%# Eval("ActionTakenUID") %>' />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="Tag" HeaderText="Tag" SortExpression="Tag"
                        UniqueName="Tag">
                        <ItemTemplate>
                            <asp:Label ID="ArchivedLabel" runat="server" Text='<%# Eval("Archived") %>' Visible="false" />
                            <asp:LinkButton ID="TagLabel" runat="server" PostBackUrl="" SkinID="EditForms" Text='<%# Eval("Tag") %>' />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="ProductName" HeaderText="Product Name" SortExpression="ProductName"
                        UniqueName="ProductName">
                        <ItemTemplate>
                            <asp:Label ID="ProductNameLabel" runat="server" SkinID="EditForms" Text='<%# Eval("ProductName") %>' />
                              
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridDateTimeColumn AutoPostBackOnFilter="True" DataField="LastScanDate"
                        DataFormatString="{0:MM/dd/yyyy}" FilterControlWidth="120px" HeaderText="Last Scan Date"
                        PickerType="DatePicker" ShowFilterIcon="false" SortExpression="LastScanDate"
                        UniqueName="LastScanDate">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridTemplateColumn DataField="ExpectedLocation" HeaderText="Expected Location"
                        SortExpression="ExpectedLocation" UniqueName="ExpectedLocation">
                        <ItemTemplate>
                            <asp:Label ID="ExpectedLocationLabel" runat="server" SkinID="EditForms" Text='<%# Eval("ExpectedLocation") %>' />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="AuditLocation" HeaderText="Audit Location"
                        SortExpression="AuditLocation" UniqueName="AuditLocation">
                        <ItemTemplate>
                            <asp:Label ID="AuditLocationLabel" runat="server" SkinID="EditForms" Text='<%# Eval("AuditLocation") %>' />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridDateTimeColumn AutoPostBackOnFilter="True" DataField="AuditScanDate"
                        DataFormatString="{0:MM/dd/yyyy}" FilterControlWidth="120px" HeaderText="Audit Date"
                        PickerType="DatePicker" ShowFilterIcon="false" SortExpression="AuditScanDate"
                        UniqueName="AuditScanDate" FilterControlAltText="=">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridTemplateColumn AllowFiltering="false" HeaderText="Actions" UniqueName="Actions"
                        Visible="true">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="clientActionLabel"></asp:Label>
                            <asp:Label ID="ActionLabel" runat="server" Text="" Visible="false" />
                            <telerik:RadToolTip ID="RadToolTipNotes" runat="server" RelativeTo="Element" TargetControlID="NotesImage"
                                Title="" Text='<%# string.Format("<br />{0}: ", Eval("Notes")) %>' AutoCloseDelay="3000"
                                Position="MiddleRight" HideDelay="300" ShowDelay="10" Animation="Slide" HideEvent="ManualClose"
                                ToolTip="" Width="200px">
                            </telerik:RadToolTip>
                            <asp:Image ID="NotesImage" runat="server" ImageUrl='<%# string.Format("~/App_Themes/{0}/Images/Notes.gif", Page.Theme) %>'
                                AlternateText='' ImageAlign="Middle" Visible="false" />
                            <telerik:RadComboBox ID="RadComboBoxActions" runat="server" AutoPostBack="False"
                                EmptyMessage="Select Action" OnClientSelectedIndexChanged="onSelectedIndexChanged"
                                Width="155px" CausesValidation="False" />
                        </ItemTemplate>
                        <ItemStyle Width="155px" />
                    </telerik:GridTemplateColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
        </telerik:RadGrid>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
        <telerik:RadAjaxManagerProxy runat="server" ID="RadAjaxManagerProxy1">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="ImageButtonGo">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGridAudits" LoadingPanelID="RadAjaxLoadingPanel1">
                        </telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGridAudits">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGridAudits" LoadingPanelID="RadAjaxLoadingPanel1">
                        </telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>
    </asp:Content>


    CODE CODE

    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Linq;
    using System.Linq.Expressions;
    using System.Text;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using LinqKit;
    using TIPWebITLibrary.BLL.AuditManagement;
    using TIPWebITLibrary.BLL.Common;
    using TIPWebITLibrary.BLL.InventoryManagement;
    using TIPWebITLibrary.BLL.UserManagement;
    using TIPWebITLibrary.DAL;
    using Telerik.Web.UI;
     
    namespace TIPWebIT.AuditManagement
    {
        public partial class ReconcileAdministrative : System.Web.UI.Page
        {
            #region WEB METHODS
            //================================================================
            //===   WEB METHODS
            //================================================================
            [System.Web.Services.WebMethod]
            public static string ChangeTagStatus(string action, string tag, string auditDetailUID, string auditDetailRoomUID, string message)
            {
     
                var user = (User)HttpContext.Current.Session["currentUser"];
     
                // return string.Format(" AuditDetailRoomUID: {0}| UserName: {1}", AuditDetailRoomUID, user.LoginName);
     
                // Take code from current reconcile process and copy here.. Must be made static.
                //  I have passed in the needed variable info for the exisiting code base to work..
                //  I think we nned to try and move this replicated code into a BLL for better control...
     
                int adUID = Convert.ToInt32(auditDetailUID, CultureInfo.InvariantCulture);
     
                using (var item = new Inventory(tag))
                {
                    if (string.IsNullOrEmpty(item.ValidationMessage))
                    {
                        item.LastModifiedByUserID = user.UserID;
                        var enumAction = (AuditActionTypes)Enum.Parse(typeof(AuditActionTypes), action);   // Convert the string to a Enumerated Action Type...
                        switch (enumAction)
                        {
     
                            case AuditActionTypes.Stolen: //"Stolen":
     
                                item.TagObject.Validate(TIPWebITLibrary.BLL.InventoryManagement.validationOperation.Stolen);
                                item.StatusUID = 63; //Room Stolen
     
                                item.Update(TIPWebITResource.AuditChangedToStolen);
                                using (
                                    var auditDetailInventoryCount = new AuditDetailInventoryCount(adUID, item.InventoryUID))
                                {
                                    if (string.IsNullOrEmpty(auditDetailInventoryCount.ValidationMessage))
                                    {
                                        auditDetailInventoryCount.Notes = TIPWebITResource.Stolen + message;
                                        auditDetailInventoryCount.ActionTypeUID = (int)AuditActionTypes.Stolen;
                                        auditDetailInventoryCount.Update();
                                    }
                                }
                                break;
                            case AuditActionTypes.Lost: //"Lost":
                                if (string.IsNullOrEmpty(item.ValidationMessage))
                                {
                                    item.TagObject.Validate(TIPWebITLibrary.BLL.InventoryManagement.validationOperation.Lost);
                                    item.StatusUID = 49; //Room Lost
                                    item.LastModifiedByUserID = user.UserID;
                                    item.Update(TIPWebITResource.AuditChangedToLost);
                                    using (
                                        var auditDetailInventoryCount = new AuditDetailInventoryCount(adUID,
                                                                                                      item.InventoryUID))
                                    {
                                        if (string.IsNullOrEmpty(auditDetailInventoryCount.ValidationMessage))
                                        {
                                            auditDetailInventoryCount.Notes = TIPWebITResource.Lost + message;
                                            auditDetailInventoryCount.ActionTypeUID = (int)AuditActionTypes.Lost;
                                            auditDetailInventoryCount.Update();
                                        }
                                    }
                                }
                                break;
                            case AuditActionTypes.Collected: // "Collect":
                                if (string.IsNullOrEmpty(item.ValidationMessage))
                                {
                                    int roomUID = Convert.ToInt32(auditDetailRoomUID, CultureInfo.InvariantCulture);
                                    item.LastModifiedDate = DateTime.Now;
                                    item.TagObject.Validate(validationOperation.Acquire);
                                    item.EntityUID = roomUID;
                                    item.EntityTypeUID = (int)EntityTypeEnum.Room;
                                    using (var room = new TIPWebITLibrary.BLL.RoomManagement.Room(roomUID))
                                    {
                                        item.SiteUID = room.SiteUID;
                                    }
                                    item.StatusUID = 26; //Room Available
                                    item.Update(TIPWebITResource.AuditCollected);
                                    using (
                                        var auditDetailInventoryCount =
                                            new AuditDetailInventoryCount(
                                                Convert.ToInt32(adUID, CultureInfo.InvariantCulture), item.InventoryUID))
                                    {
                                        if (string.IsNullOrEmpty(auditDetailInventoryCount.ValidationMessage))
                                        {
                                            auditDetailInventoryCount.Notes = TIPWebITResource.Collected + message;
                                            auditDetailInventoryCount.ActionTypeUID = (int)AuditActionTypes.Collected;
                                            auditDetailInventoryCount.Update();
                                        }
                                    }
                                }
                                break;
                            case AuditActionTypes.NoAction: // "No Action":
                                if (string.IsNullOrEmpty(item.ValidationMessage))
                                {
                                    int roomUID = Convert.ToInt32(auditDetailRoomUID, CultureInfo.InvariantCulture);
     
                                    using (
                                        TIPWebITLibrary.BLL.AuditManagement.AuditDetailInventoryCount
                                            auditDetailInventoryCount =
                                                new TIPWebITLibrary.BLL.AuditManagement.AuditDetailInventoryCount(
                                                    Convert.ToInt32(adUID, CultureInfo.InvariantCulture), item.InventoryUID)
                                        )
                                    {
                                        if (string.IsNullOrEmpty(auditDetailInventoryCount.ValidationMessage))
                                        {
                                            auditDetailInventoryCount.Notes = TIPWebITResource.NoAction + message;
                                            auditDetailInventoryCount.ActionTypeUID = (int)AuditActionTypes.NoAction;
                                            auditDetailInventoryCount.Update();
                                        }
                                    }
                                }
                                break;
                            default:
                                return null;
                        }
                        using (var auditDetail = new AuditDetail(adUID))
                        {
                            if (!auditDetail.ActionNeeded() && auditDetail.StatusID == 55)
                            //Finalized, should always be this
                            {
                                auditDetail.StatusID = 56; //Closed
                                auditDetail.LastModifiedByUserID = user.UserID;
                                auditDetail.LastModifiedDate = DateTime.Now;
                                auditDetail.Update();
                            }
                        }
                    }
                    else
                    {
                        return String.Format(CultureInfo.InvariantCulture, "Validation Error: data was not updated-{0}", item.ValidationMessage);
                    }
                }
     
     
     
                return true.ToString(CultureInfo.InvariantCulture);
            }
     
            //================================================================
            //===   END WEB METHODS
            //================================================================
     
            #endregion
     
            public bool SiteViewAdminRestrictReconcilingRoomAuditResults
            {
                get { return (bool)ViewState["SiteViewAdminRestrictReconcilingRoomAuditResults"]; }
            }
     
            public bool SiteViewUserRestrictReconcilingRoomAuditResults
            {
                get { return (bool)ViewState["SiteViewUserRestrictReconcilingRoomAuditResults"]; }
            }
     
            protected void Page_Load(object sender, EventArgs e)
            {
                RadAjaxManager manager = RadAjaxManager.GetCurrent(this.Page);
                manager.ClientEvents.OnResponseEnd = "ucOnResponseEnd";
     
     
                RadGridAudits.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
     
                Page.Header.Attributes.Add("data-is-postback", Page.IsPostBack ? "true" : "false");
     
     
                if (!Page.IsPostBack)
                {
                    RadWindowActionNotes.Behaviors = Telerik.Web.UI.WindowBehaviors.None;
                    RadWindowActionNotes.Behaviors = WindowBehaviors.Move;
                    RadWindowActionNotes.Modal = true;
     
                    Master.HeaderImagePath = "~/App_Themes/" + Page.Theme + "/Images/Audit.gif";
                    Master.HeaderText = "Audit";
     
                    PopulateRadComboSiteName();
                    PopulateRadTagComboAuditState();
                    PopulateRadComboRoomAuditStatus();
                    PopulateRadComboExpectedLocationType();
                    PopulateRadComboHardwareType();
                }
     
            }
     
            private void PopulateRadComboSiteName()
            {
                using (var db = new TIPWebITDataContext())
                {
                    var sites = db.tblTechSites.Where(x => x.Active && x.SiteUID != 1).OrderBy(x => x.SiteName);
                    RadComboSiteName.DataTextField = "SiteName";
                    RadComboSiteName.DataValueField = "SiteUID";
                    RadComboSiteName.DataSource = sites;
                    RadComboSiteName.DataBind();
     
                }
            }
     
            private void PopulateRadTagComboAuditState()
            {
                using (var db = new TIPWebITDataContext())
                {
                    var tagAuditStates = db.tblStatus.Where(x => x.StatusTypeUID == 12).OrderBy(x => x.statusDesc);   //AuditInventoryStates
                    RadComboTagAuditState.DataTextField = "statusDesc";
                    RadComboTagAuditState.DataValueField = "statusID";
                    RadComboTagAuditState.DataSource = tagAuditStates;
                    RadComboTagAuditState.DataBind();
                }
     
            }
     
            private void PopulateRadComboRoomAuditStatus()
            {
                using (var db = new TIPWebITDataContext())
                {
                    var roomAuditStatuses =
                        db.tblStatus.Where(x => x.StatusTypeUID == 13).OrderBy(x => x.statusDesc);
                    RadComboRoomAuditStatus.DataTextField = "statusDesc";
                    RadComboRoomAuditStatus.DataValueField = "statusID";
                    RadComboRoomAuditStatus.DataSource = roomAuditStatuses;
                    RadComboRoomAuditStatus.DataBind();
     
                }
            }
     
            private void PopulateRadComboExpectedLocationType()
            {
     
                using (var db = new TIPWebITDataContext())
                {
                    var entityTypes =
                        db.tblUnvEntityTypes.Where(
                            x =>
                                 x.EntityTypeUID == 2 ||
                                 x.EntityTypeUID == 3 ||
                                 x.EntityTypeUID == 4)
                          .OrderBy(x => x.Description);
                    RadComboExpectedLocationType.DataTextField = "Description";
                    RadComboExpectedLocationType.DataValueField = "EntityTypeUID";
                    RadComboExpectedLocationType.DataSource = entityTypes;
                    RadComboExpectedLocationType.DataBind();
     
                }
            }
     
            protected void PopulateRadComboHardwareType()
            {
                using (var db = new TIPWebITDataContext())
                {
                    var itemTypes = db.tblTechItemTypes.Where(x => x.ItemTypeUID != 0)
                                      .OrderBy(x => x.ItemTypeName);
                    RadComboHardwareType.DataTextField = "ItemTypeName";
                    RadComboHardwareType.DataValueField = "ItemTypeUID";
                    RadComboHardwareType.DataSource = itemTypes;
                    RadComboHardwareType.DataBind();
                }
            }
     
            private List<AuditReconcileView> GetAuditData()
            {
                if (!Page.IsPostBack)
                {
                    var emptyResult = new List<AuditReconcileView>();
                    return emptyResult.ToList();
                }
                using (var context = new TIPWebITDataContext())
                {
                    List<int> userDepartments = ((User)HttpContext.Current.Session["currentUser"]).Departments;
     
                    var filterAuditState = (from item in RadComboTagAuditState.CheckedItems select Convert.ToInt32(item.Value, CultureInfo.InvariantCulture)).ToList();
                    //RadComboExpectedLocationType
                    var filterExpectedLocationType = (from item in RadComboExpectedLocationType.CheckedItems select Convert.ToInt32(item.Value, CultureInfo.InvariantCulture)).ToList();
                    //RadComboRoomAuditStatus
                    var filterRoomAuditStatus = (from item in RadComboRoomAuditStatus.CheckedItems select Convert.ToInt32(item.Value, CultureInfo.InvariantCulture)).ToList();
                    //RadComboHardwareType
                    var filterHardwareType = (from item in RadComboHardwareType.CheckedItems select Convert.ToInt32(item.Value, CultureInfo.InvariantCulture)).ToList();
     
     
                    //RadComboSiteName
                    var filterSiteUID = (from item in RadComboSiteName.CheckedItems select Convert.ToInt32(item.Value, CultureInfo.InvariantCulture)).ToList();
     
                    //RadDatePickerAuditDateAfter
                    DateTime? filterAuditDateAfter = (DateTime?)RadDatePickerAuditDateAfter.SelectedDate;
                    DateTime? filterAuditDateAfterBetween = (DateTime?)RadDatePickerAuditDateAfterBetween.SelectedDate;
     
                    //RadDatePickerLastScanDate
                    DateTime? filterLastScanDate = (DateTime?)RadDatePickerLastScanDate.SelectedDate;
                    DateTime? filterLastScanDateBetween = (DateTime?)RadDatePickerLastScanDateBetween.SelectedDate;
     
                    //RadNumericTextboxPrice
                    decimal? filterPrice = (decimal?)RadNumericTextBoxPrice.Value;
                    decimal? filterPriceBetween = (decimal?)RadNumericTextBoxPriceBetween.Value;
     
                    var result = (from inventory in context.tblTechInventories
                                  join adic in
                                      (from auditDetailInventoryCount in context.tblTechAuditDetailInventoryCounts
                                       group auditDetailInventoryCount by new { auditDetailInventoryCount.InventoryUID }
                                           into g
                                           select new
                                               {
                                                   g.Key.InventoryUID,
                                                   LastModifiedDate = g.Max(m => m.LastModifiedDate)
                                               }) on inventory.InventoryUID equals adic.InventoryUID into selfJoin
                                  from adic in selfJoin.DefaultIfEmpty()
                                  join adicState in
                                      (from auditDetailInventoryCount in context.tblTechAuditDetailInventoryCounts
                                       group auditDetailInventoryCount by
                                           new
                                               {
                                                   auditDetailInventoryCount.InventoryUID,
                                                   auditDetailInventoryCount.LastModifiedDate
                                               }
                                           into groupState
                                           select new
                                               {
                                                   groupState.Key.InventoryUID,
                                                   groupState.Key.LastModifiedDate,
                                                   StatusID = groupState.Max(m => m.StatusID)
                                               }) on new { adic.InventoryUID, adic.LastModifiedDate } equals
                                      new { adicState.InventoryUID, adicState.LastModifiedDate } into selfJoinAdicState
                                  from adicState in selfJoinAdicState.DefaultIfEmpty()
                                  join adicUID in
                                      (from auditDetailInventoryCount in context.tblTechAuditDetailInventoryCounts
                                       group auditDetailInventoryCount by
                                           new
                                               {
                                                   auditDetailInventoryCount.InventoryUID,
                                                   auditDetailInventoryCount.LastModifiedDate,
                                                   auditDetailInventoryCount.StatusID
                                               }
                                           into groupUID
                                           select new
                                               {
                                                   groupUID.Key.InventoryUID,
                                                   groupUID.Key.LastModifiedDate,
                                                   groupUID.Key.StatusID,
                                                   adicUID = groupUID.Max(m => m.AuditDetailInventoryCountUID)
                                               }) on
                                      new { adicState.InventoryUID, adicState.LastModifiedDate, adicState.StatusID } equals
                                      new { adicUID.InventoryUID, adicUID.LastModifiedDate, adicUID.StatusID } into
                                      selfJoinAdicUID
                                  from adicUID in selfJoinAdicUID.DefaultIfEmpty()
                                  join adicLast in
                                      (from auditDetailInventoryCount in context.tblTechAuditDetailInventoryCounts
                                       join auditDetailInventoryCountState in context.tblStatus
                                           on auditDetailInventoryCount.StatusID equals
                                           auditDetailInventoryCountState.statusID
     
                                       join auditDetail in context.tblTechAuditDetails
                                           on auditDetailInventoryCount.AuditDetailUID equals auditDetail.AuditDetailUID
                                       join auditStatus in context.tblStatus on auditDetail.StatusID equals
                                           auditStatus.statusID
                                       join site in context.tblTechSites on auditDetail.SiteUID equals site.SiteUID
                                       join room in context.tblUnvRooms on auditDetail.RoomUID equals room.RoomUID
     
                                       select new
                                           {
                                               auditDetailInventoryCount.AuditDetailInventoryCountUID,
                                               auditDetail.AuditDetailUID,
                                               auditDetail.AuditUID,
                                               auditDetail.StatusID,
                                               Status = auditStatus.statusDesc,
                                               SiteUID = auditDetail.SiteUID,
                                               SiteName = site.SiteName,
                                               RoomUID = room.RoomUID,
                                               Location = " Room: " + room.RoomNumber,
                                               ScanDate = auditDetailInventoryCount.LastModifiedDate,
                                               StateID = auditDetailInventoryCount.StatusID,
                                               State = auditDetailInventoryCountState.statusDesc,
                                               Notes = auditDetailInventoryCount.Notes,
                                               ActionTakenUID = auditDetailInventoryCount.ActionTypeUID
                                           }) on adicUID.adicUID equals adicLast.AuditDetailInventoryCountUID into
                                      selfJoinLast
                                  from adicLast in selfJoinLast.DefaultIfEmpty()
                                  join auditDepartments in context.tblTechAuditDepartments on adicLast.AuditUID equals
                                        auditDepartments.AuditUID into ad
                                  from auditDepartments in ad.DefaultIfEmpty()
                                  join audit in context.tblUnvAudits on adicLast.AuditUID equals audit.AuditUID into ua
                                  from audit in ua.DefaultIfEmpty()
                                  join iHist in
                                      (from iH in context.tblTechInventoryHistories
                                       join aC in context.tblTechAuditDetailInventoryCounts
                                           on iH.InventoryUID equals aC.InventoryUID into ac
                                       from aC in ac.DefaultIfEmpty()
                                       join aD in context.tblTechAuditDetails
                                           on aC.AuditDetailUID equals aD.AuditDetailUID into ad
                                       from aD in ad.DefaultIfEmpty()
                                       where iH.CreatedDate <=
                                             (aD.StatusID == null
                                                  ? DateTime.Now
                                                  : aD.StatusID != 56 ? DateTime.Now : aD.LastModifiedDate)
                                       //Closed
                                       group iH by new
                                           {
                                               iH.InventoryUID,
                                           }
                                           into iHg
                                           select new
                                               {
                                                   iHg.Key.InventoryUID,
                                                   InventoryHistoryUID = iHg.Max(m => m.InventoryHistoryUID)
                                               }) on inventory.InventoryUID equals iHist.InventoryUID into histGroup
                                  from iHist in histGroup.DefaultIfEmpty()
                                  join inventoryHistory in context.tblTechInventoryHistories
                                      on iHist.InventoryHistoryUID equals inventoryHistory.InventoryHistoryUID into
                                      selfJoinHist
                                  from inventoryHistory in selfJoinHist.DefaultIfEmpty()
                                  join inventoryHistorySite in context.tblTechSites on inventoryHistory.SiteUID equals
                                      inventoryHistorySite.SiteUID
                                  join item in context.tblTechItems on inventory.ItemUID equals item.ItemUID
                                  join a in context.tblUnvArchives on inventory.ArchiveUID equals a.ArchiveUID into archive
                                  from a in archive.DefaultIfEmpty()
                                  join au in context.tblUsers on a.ArchiveUserID equals au.UserID into archiveUser
                                  from au in archiveUser.DefaultIfEmpty()
                                  join entityType in context.tblUnvEntityTypes on inventoryHistory.EntityTypeUID equals
                                      entityType.EntityTypeUID
                                  join room in context.tblUnvRooms on inventoryHistory.EntityUID equals room.RoomUID into r
                                  from room in r.DefaultIfEmpty()
                                  join roomSite in context.tblTechSites on room.SiteUID equals roomSite.SiteUID into rs
                                  from roomSite in rs.DefaultIfEmpty()
                                  join staff in context.tblTeachers on inventoryHistory.EntityUID equals staff.TeachersUID
                                      into t
                                  from staff in t.DefaultIfEmpty()
                                  join student in context.tblStudents on inventoryHistory.EntityUID equals
                                      student.StudentsUID into s
                                  from student in s.DefaultIfEmpty()
                                  join transfer in context.tblTechTransfers on inventoryHistory.EntityUID equals
                                      transfer.TransferUID into tf
                                  from transfer in tf.DefaultIfEmpty()
                                  select new AuditReconcileView
                                      {
                                          ActionTakenUID = adicLast.ActionTakenUID == null ? 0 : adicLast.ActionTakenUID,
                                          AuditDetailRoomUID = (int?)adicLast.RoomUID,
                                          AuditDetailUID = (int?)adicLast.AuditDetailUID,
                                          RoomAuditStatusUID = (int?)adicLast.StatusID,
                                          RoomAuditStatus = adicLast.Status,
                                          Notes = adicLast.Notes,
                                          TagAuditStateUID = (int?)adicLast.StateID,
                                          TagAuditState = adicLast.State,
                                          AuditDate = (DateTime?)audit.CreatedDate,
                                          Tag = inventory.Tag,
                                          ProductName = item.ItemName,
                                          HardwareTypeUID = item.ItemTypeUID,
                                          Price = item.ItemSuggestedPrice,
                                          LastScanDate =
                                      inventory.ArchiveUID > 0 ? a.ArchiveDate : (inventory.LastModifiedDate),
                                          //LastScanBy =
                                          //    i.ArchiveUID > 0
                                          //        ? (au.RealName == null ? TIPWebITResource.MissingUserRecord : au.RealName)
                                          //        : (scanner.RealName == null
                                          //               ? TIPWebITResource.MissingUserRecord
                                          //               : scanner.RealName),
                                          ExpectedSiteUID = inventoryHistory.SiteUID,
                                          ExpectedLocationType = entityType.EntityTypeUID,
                                          // i.ArchiveUID > 0 ? string.Empty : (entityType.Description + ": " + (inventory.EntityTypeUID == 6 ? transfer.TransferNumber.ToString() : inventory.EntityTypeUID == 4 ? student.FullName : inventory.EntityTypeUID == 3 ? staff.FullName : room.RoomNumber)),
                                          ExpectedLocation =
                                      inventory.ArchiveUID > 0
                                          ? string.Empty
                                          : ((adicLast.SiteUID != roomSite.SiteUID ? "<span style='color: red;'>Site: " + roomSite.SiteName + "</span><br />" : "") + entityType.Description + ": " +
                                             (inventoryHistory.EntityTypeUID == 6
                                                  ? transfer.TransferNumber.ToString()
                                                  : inventoryHistory.EntityTypeUID == 4
                                                        ? student.FullName
                                                        : inventoryHistory.EntityTypeUID == 3
                                                              ? staff.FullName
                                                              : room.RoomNumber)),
                                          AuditLocation = adicLast.Location,
                                          AuditScanDate = (DateTime?)adicLast.ScanDate,
                                          //AuditScanBy = adicLast.ScanBy,
                                          //g.Key.SiteUID,
                                          AuditSiteUID = adicLast.SiteUID == null ? 0 : adicLast.SiteUID,
                                          AuditSite = adicLast.SiteName == null ? "" : adicLast.SiteName,
                                          Archived = inventory.ArchiveUID > 0 ? "Archived" : string.Empty
                                      }).AsQueryable();
     
     
     
                    //===================Filters that are required====================
                    // Done -  Tag Audit State (Status)   from count table      = Tag
                    // Done - Site Name                                         = SiteUID   
                    // Done - Audit Date After                                  = AuditDate
                    // Done -  Expected Location Type                           = ExpectedLocationType 
                    //Room Audit Status   from teh details table                = RoomAuditStatus
                    //Hardware Type                                             = HardwareTypeUID
                    //Last Scan Date                                            = LastScanDate                  
                    //Price                                                     =
     
                    //==============================================================
                    //===   MULTI-SELECT COMBO FILTERS
                    //==============================================================
                    var predicateTagAuditState = PredicateBuilder.False<AuditReconcileView>();
                    if (filterAuditState.Any())
                    {
                        predicateTagAuditState = filterAuditState.Aggregate(predicateTagAuditState, (current, temp) => current.Or(p => p.TagAuditStateUID.Equals(temp)));
     
                        //NOTE: left this as an example of how it would look in a for loop
                        //foreach (var item in filterAuditState)
                        //{
                        //    int temp = item;
                        //    predicateTagAuditState = predicateTagAuditState.Or(p => p.TagAuditStateUID.Equals(temp));
                        //}
                    }
     
                    var predicateExpectedLocationType = PredicateBuilder.False<AuditReconcileView>();
                    if (filterExpectedLocationType.Any())
                    {
                        predicateExpectedLocationType = filterExpectedLocationType.Aggregate(predicateExpectedLocationType, (current, temp) => current.Or(p => p.ExpectedLocationType.Equals(temp)));
                    }
     
                    var predicateRoomStatus = PredicateBuilder.False<AuditReconcileView>();
                    if (filterRoomAuditStatus.Any())
                    {
                        predicateRoomStatus = filterRoomAuditStatus.Aggregate(predicateRoomStatus, (current, temp) => current.Or(p => p.RoomAuditStatusUID.Equals(temp)));
                    }
     
                    var predicateHardwareType = PredicateBuilder.False<AuditReconcileView>();
                    if (filterHardwareType.Any())
                    {
                        predicateHardwareType = filterHardwareType.Aggregate(predicateHardwareType, (current, temp) => current.Or(p => p.HardwareTypeUID.Equals(temp)));
                    }
     
     
                    var predicateSiteUID = PredicateBuilder.False<AuditReconcileView>();
                    if (filterSiteUID.Any())
                    {
                        predicateSiteUID = filterSiteUID.Aggregate(predicateSiteUID, (current, siteUID) => current.Or(p => p.AuditSiteUID.Equals(siteUID)));
                    }
     
     
     
     
     
                    //==============================================================
                    //===   Between & DATE FILTERS
                    //==============================================================
                    var predicateAuditDateAfter = PredicateBuilder.False<AuditReconcileView>();
                    if (filterAuditDateAfter != null)
                    {
                        DateTime afterDate = Convert.ToDateTime(((DateTime)filterAuditDateAfter).ToShortDateString() + " 12:00:00 AM", CultureInfo.InvariantCulture);
                        var afterDateNoTime = ((DateTime)filterAuditDateAfter).ToShortDateString();
                        switch (RadComboBoxAuditDateAfterSearchType.SelectedValue)
                        {
     
                            case "greaterthan":
                                predicateAuditDateAfter = predicateAuditDateAfter.Or(p => p.AuditDate >= afterDate);
                                break;
                            case "lessthan":
                                predicateAuditDateAfter = predicateAuditDateAfter.Or(p => p.AuditDate <= afterDate);
                                break;
                            case "equalto":
                                // Because the date in the system could contain a Time ....
     
                                DateTime afterDateEqualBetween = Convert.ToDateTime((afterDate).ToShortDateString() + " 11:59:59 PM", CultureInfo.InvariantCulture);
                                predicateAuditDateAfter = predicateAuditDateAfter.Or(p => p.AuditDate >= afterDate && p.AuditDate <= afterDateEqualBetween);
     
     
                                //  predicateAuditDateAfter = predicateAuditDateAfter.Or(p => p.AuditDate == afterDate);
                                break;
                            case "between":
                                if (filterAuditDateAfterBetween == null) break;
                                DateTime afterDateBetween = Convert.ToDateTime(((DateTime)filterAuditDateAfterBetween).ToShortDateString() + " 11:59:59 PM", CultureInfo.InvariantCulture);
                                predicateAuditDateAfter = predicateAuditDateAfter.Or(p => p.AuditDate >= afterDate && p.AuditDate <= afterDateBetween);
                                break;
                        }
                    }
     
     
                    var predicateLastScanDate = PredicateBuilder.False<AuditReconcileView>();
     
                    if (filterLastScanDate != null)
                    {
                        DateTime lastScanDate = Convert.ToDateTime(((DateTime)filterLastScanDate).ToShortDateString() + " 12:00:00 AM", CultureInfo.InvariantCulture);
     
                        switch (RadComboBoxLastScanDateSearchType.SelectedValue)
                        {
                            case "greaterthan":
                                predicateLastScanDate = predicateLastScanDate.Or(p => p.LastScanDate >= lastScanDate);
                                break;
                            case "lessthan":
                                predicateLastScanDate = predicateLastScanDate.Or(p => p.LastScanDate <= lastScanDate);
                                break;
                            case "equalto":
                                // Because the date in the system could contain a Time ....
     
                                DateTime lastScanDateEqualBetween = Convert.ToDateTime((lastScanDate).ToShortDateString() + " 11:59:59 PM", CultureInfo.InvariantCulture);
                                predicateLastScanDate = predicateLastScanDate.Or(p => p.LastScanDate >= lastScanDate && p.LastScanDate <= lastScanDateEqualBetween);
     
                                // predicateLastScanDate = predicateLastScanDate.Or(p => p.LastScanDate == lastScanDate);
                                break;
                            case "between":
                                if (filterLastScanDateBetween == null) break;
                                DateTime lastScanDateBetween = Convert.ToDateTime(((DateTime)filterLastScanDateBetween).ToShortDateString() + " 11:59:59 PM", CultureInfo.InvariantCulture);
                                predicateLastScanDate = predicateLastScanDate.Or(p => p.LastScanDate >= lastScanDate && p.LastScanDate <= lastScanDateBetween);
                                break;
                        }
                    }
     
                    var predicatePrice = PredicateBuilder.False<AuditReconcileView>();
                    if (filterPrice != null)
                    {
     
     
                        decimal? price = filterPrice;
                        var filterType = RadComboBoxPriceSearchType.SelectedValue;
     
                        switch (filterType)
                        {
                            case "greaterthan":
                                predicatePrice = predicatePrice.Or(p => p.Price >= price);
                                break;
                            case "lessthan":
                                predicatePrice = predicatePrice.Or(p => p.Price <= price);
                                break;
     
                            case "equalto":
                                predicatePrice = predicatePrice.Or(p => p.Price == price);
                                break;
                            case "between":
                                if (PriceBetween == null) break;
                                decimal? priceBetween = filterPriceBetween;
                                predicatePrice = predicatePrice.Or(p => p.Price >= price && p.Price <= priceBetween);
                                break;
                        }
     
                    }
     
     
     
                    // BUILD FILTER EXPRESSION USING LINQKIT Dynamic Predicates - See http://www.albahari.com/nutshell/linqkit.aspx
     
                    // finalPredicate will be built depending on the filter sets the user has selected.
                    Expression<Func<AuditReconcileView, bool>> finalPredicates = null;
     
     
     
                    // I could have included these in the code above, but I believe this will be a bit more clear for the next developer.
                    if (filterAuditState.Any())
                    {
                        finalPredicates = predicateTagAuditState;
                    }
     
                    if (filterExpectedLocationType.Any())
                    {
                        finalPredicates = finalPredicates == null ? predicateExpectedLocationType : finalPredicates.And(predicateExpectedLocationType);
     
                    }
     
                    if (filterRoomAuditStatus.Any())
                    {
                        finalPredicates = finalPredicates == null ? predicateRoomStatus : finalPredicates.And(predicateRoomStatus);
                    }
     
                    if (filterSiteUID.Any())
                    {
                        finalPredicates = finalPredicates == null ? predicateSiteUID : finalPredicates.And(predicateSiteUID);
                    }
     
                    if (filterHardwareType.Any())
                    {
                        finalPredicates = finalPredicates == null ? predicateHardwareType : finalPredicates.And(predicateHardwareType);
     
                    }
     
                    //NOTE: There might be a clearner way to do this logic.
     
     
                    //===========================
                    //==    Audit Date After
                    //===========================
                    if (filterAuditDateAfter != null && filterAuditDateAfterBetween != null)
                    {
                        finalPredicates = finalPredicates == null
                                               ? predicateAuditDateAfter
                                               : finalPredicates.And(predicateAuditDateAfter);
                    }
                    else
                    {
                        if (filterAuditDateAfter != null)
                        {
                            finalPredicates = finalPredicates == null
                                                  ? predicateAuditDateAfter
                                                  : finalPredicates.And(predicateAuditDateAfter);
                        }
                    }
     
                    //============================
                    //==    Last Scan Date
                    //============================
                    if (filterLastScanDate != null && filterLastScanDateBetween != null)
                    {
                        finalPredicates = finalPredicates == null
                                               ? predicateLastScanDate
                                               : finalPredicates.And(predicateLastScanDate);
                    }
                    else
                    {
                        if (filterLastScanDate != null)
                        {
                            finalPredicates = finalPredicates == null ? predicateLastScanDate : finalPredicates.And(predicateLastScanDate);
                        }
                    }
     
                    //==================================
                    //==    Price
                    //==================================
                    if (filterPrice != null && filterPriceBetween != null)
                    {
                        finalPredicates = finalPredicates == null
                                               ? predicatePrice
                                               : finalPredicates.And(predicatePrice);
                    }
                    else
                    {
                        if (filterPrice != null)
                        {
                            finalPredicates = finalPredicates == null ? predicatePrice : finalPredicates.And(predicatePrice);
                        }
                    }
     
                    //==============================================
                    //==  Add All predicates to the where clause
                    //==  in the linq result set... 
                    //==============================================
                    if (finalPredicates != null)
                    {
                        var filterResult = result.Where(finalPredicates);
                        return filterResult.OrderBy(x => x.AuditDate).ToList();
                    }
                    return result.OrderBy(x => x.AuditDate).ToList();
                }
            }
     
            protected void ImageButtonGo_Click(object sender, ImageClickEventArgs e)
            {
     
                RadGridAudits.DataSource = GetAuditData();
                RadGridAudits.Visible = true;
                RadGridAudits.MasterTableView.SortExpressions.Clear();
                RadGridAudits.Rebind();
     
            }
     
            protected void ImageButtonReset_Click(object sender, ImageClickEventArgs e)
            {
     
            }
     
            private void configureRadComboBoxActions()
            {
     
            }
     
            protected void RadGridAudits_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
            {
                if (e == null)
                {
                    return;
                }
                var user = (User)Session["currentUser"];
                if (e.Item is GridPagerItem)
                {
                    RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
                    PageSizeCombo.Items.Clear();
                    PageSizeCombo.Items.Add(new RadComboBoxItem(TIPWebITResource.Number10));
                    PageSizeCombo.FindItemByText(TIPWebITResource.Number10).Attributes.Add("ownerTableViewId", RadGridAudits.MasterTableView.ClientID);
                    PageSizeCombo.Items.Add(new RadComboBoxItem(TIPWebITResource.Number15));
                    PageSizeCombo.FindItemByText(TIPWebITResource.Number15).Attributes.Add("ownerTableViewId", RadGridAudits.MasterTableView.ClientID);
                    PageSizeCombo.Items.Add(new RadComboBoxItem(TIPWebITResource.Number20));
                    PageSizeCombo.FindItemByText(TIPWebITResource.Number20).Attributes.Add("ownerTableViewId", RadGridAudits.MasterTableView.ClientID);
                    PageSizeCombo.Items.Add(new RadComboBoxItem(TIPWebITResource.Number30));
                    PageSizeCombo.FindItemByText(TIPWebITResource.Number30).Attributes.Add("ownerTableViewId", RadGridAudits.MasterTableView.ClientID);
                    PageSizeCombo.Items.Add(new RadComboBoxItem(TIPWebITResource.Number50));
                    PageSizeCombo.FindItemByText(TIPWebITResource.Number50).Attributes.Add("ownerTableViewId", RadGridAudits.MasterTableView.ClientID);
                    PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString(CultureInfo.InvariantCulture)).Selected = true;
                }
     
                if (e.Item is GridDataItem)
                {
     
                    Image stateImage = (Image)e.Item.FindControl("ImageState");
                    Label LabelTagAuditState = (Label)e.Item.FindControl("LabelTagAuditState");
                    HiddenField hiddenFieldActionTakenUID = (HiddenField)e.Item.FindControl("hiddenFieldActionTakenUID");
                    if (LabelTagAuditState.Text == "Missing")
                    {
                        stateImage.ImageUrl = string.Format(CultureInfo.InvariantCulture, "~/App_Themes/{0}/Images/Approve_Red_16.gif", Page.Theme);
                    }
                    else if (LabelTagAuditState.Text == "Misplaced")
                    {
                        stateImage.ImageUrl = string.Format(CultureInfo.InvariantCulture, "~/App_Themes/{0}/Images/Alert_16.gif", Page.Theme);
                    }
                    else if (LabelTagAuditState.Text == "Verified")
                    {
                        stateImage.ImageUrl = string.Format(CultureInfo.InvariantCulture, "~/App_Themes/{0}/Images/Approve_16.gif", Page.Theme);
                    }
                    else
                    {
                        stateImage.Visible = false;
                    }
     
     
                    LinkButton TagLabel = (LinkButton)e.Item.FindControl("TagLabel");
                    TagLabel.OnClientClick = "OpenTagInfo('" + TagLabel.Text.Trim() + "'); return false;";
     
                    //====================================
                    //===   ACTION COLUMN
                    //====================================
                    Image notesImage = (Image)e.Item.FindControl("NotesImage");
                    RadComboBox radComboBoxActions = (RadComboBox)e.Item.FindControl("RadComboBoxActions");
                    Label actionLabel = (Label)e.Item.FindControl("ActionLabel");
                    //  HiddenField archived = (HiddenField)e.Item.FindControl("ArchivedHidden");
                    RadToolTip toolTip = (RadToolTip)e.Item.FindControl("RadToolTipNotes");
                    // HiddenField ActionTaken = (HiddenField) e.Item.FindControl("ActionTaken");
     
                    //Convert string (ActionTypeUID) from hidden field in grid to enum AuditActionTypes
                    var auditActionTypes = (AuditActionTypes)Enum.Parse(typeof(AuditActionTypes), hiddenFieldActionTakenUID.Value);
     
                    //Check the items Current AuditState { Missing, Misplaced }
                    // By Default hide the actions combobox
                    radComboBoxActions.Visible = false;
                    if (LabelTagAuditState.Text.Length > 0)
                    {
                        switch (LabelTagAuditState.Text)
                        {
                            case "Missing":
                                ConfigureradComboBoxActions(e, LabelTagAuditState, radComboBoxActions, user, actionLabel);
                                break;
                            case "Misplaced":
                                ConfigureradComboBoxActions(e, LabelTagAuditState, radComboBoxActions, user, actionLabel);
                                break;
                            case "Verified":
                                ConfigureradComboBoxActions(e, LabelTagAuditState, radComboBoxActions, user, actionLabel);
                                break;
                            default:
                                break;
     
                        }
     
     
     
                        switch (auditActionTypes)
                        {
                            case AuditActionTypes.None:
                                //Perform operation
                                actionLabel.Visible = false;
                                notesImage.Visible = false;
                                break;
                            case AuditActionTypes.NoAction:
                                //Perform operation
                                actionLabel.Text = TIPWebITResource.NoAction;
                                notesImage.Visible = true;
                                break;
                            case AuditActionTypes.Verified:
                                //Perform operation
                                radComboBoxActions.Visible = false;
                                actionLabel.Text = TIPWebITResource.Space;
                                actionLabel.Visible = true;
                                break;
                            case AuditActionTypes.Stolen:
                                //Perform operation
                                actionLabel.Text = TIPWebITResource.Stolen;
                                notesImage.Visible = true;
                                break;
                            case AuditActionTypes.Collected:
                                //Perform operation 
                                actionLabel.Text = TIPWebITResource.Collected;
                                notesImage.Visible = true;
                                break;
                            case AuditActionTypes.Lost:
                                //Perform operation
                                actionLabel.Text = TIPWebITResource.Lost;
                                notesImage.Visible = true;
                                break;
                            default:
                                //Perform operation
     
     
                                break;
                        }
     
                    }
                    //if (LabelTagAuditState.Text != "Verified")
                    //{
                    //    ConfigureradComboBoxActions(e, LabelTagAuditState, radComboBoxActions, user, actionLabel);
                    //}
     
     
     
     
                    //if (LabelTagAuditState.Text == "Verified") //|| archived.Value == "Archived")
                    //{
                    //    actions.Visible = false;
                    //    actionLabel.Text = TIPWebITResource.Space;
                    //    actionLabel.Visible = true;
                    //}
                    //else if (toolTip.Text.Length > 6)
                    //{
                    //    actions.Visible = false;
                    //    //switch (toolTip.Text)
                    //    //{
                    //    //    case "<br />Lost prior to Audit":
                    //    //        actionLabel.Text = TIPWebITResource.Space;
                    //    //        break;
                    //    //    case  "<br />Lost":
                    //    //        actionLabel.Text = TIPWebITResource.Lost;
                    //    //        break;
                    //    //    case "<br />Collected":
                    //    //        actionLabel.Text = TIPWebITResource.Collected;
                    //    //        break;
                    //    //    case "<br />No Notes":
                    //    //        actionLabel.Text = TIPWebITResource.NoAction;
                    //    //        break;
                    //    //    case "<br />Stolen:":
                    //    //        actionLabel.Text = TIPWebITResource.Stolen;
                    //    //        break;
                    //    //    default:
                    //    //        actionLabel.Text = TIPWebITResource.NoAction;
                    //    //        notesImage.Visible = true;
                    //    //        break;
                    //    //}
     
                    //    if (toolTip.Text.Contains("Lost prior to Audit"))
                    //    {
                    //        actionLabel.Text = TIPWebITResource.Space;
                    //        notesImage.Visible = true;
                    //    }
                    //    else if (toolTip.Text.Contains("Lost"))
                    //    {
                    //        //actionLabel.Text = TIPWebITResource.Lost;
                    //        //notesImage.Visible = true;
                    //    }
                    //    else if (toolTip.Text.Contains("Collected"))
                    //    {
                    //        //actionLabel.Text = TIPWebITResource.Collected;
                    //        //notesImage.Visible = true;
                    //    }
                    //    else if (toolTip.Text.Contains("No Notes"))
                    //    {
                    //        actionLabel.Text = TIPWebITResource.NoAction;
                    //        notesImage.Visible = true;
                    //    }
                    //    else if (toolTip.Text.Contains("Stolen"))
                    //    {
                    //        actionLabel.Text = TIPWebITResource.Stolen;
                    //        notesImage.Visible = true;
                    //    }
                    //    else
                    //    {
     
                    //        actionLabel.Visible = false;
                    //        notesImage.Visible = false;
                    //        //actionLabel.Text = TIPWebITResource.NoAction;
                    //        //notesImage.Visible = true;
                    //    }
     
                    //    actionLabel.Visible = true;
                    //}
                    //else
                    //{
     
                    //    GridDataItem item = (GridDataItem)e.Item;
                    //    string auditDetailRoomUID = item.OwnerTableView.DataKeyValues[item.ItemIndex]["auditDetailRoomUID"].ToString();
                    //    string auditDetailUID = item.OwnerTableView.DataKeyValues[item.ItemIndex]["auditDetailUID"].ToString();
                    //    string tag = item.OwnerTableView.DataKeyValues[item.ItemIndex]["Tag"].ToString();
     
     
                    //    string auditDetailUIDAndTag = string.Format(CultureInfo.InvariantCulture, "{0}|{1}|{2}", auditDetailUID, auditDetailRoomUID, tag);
     
                    //    //I am using the value in the combo's to pass an array of data I am using for my ajax web method.
                    //    //Do not change the order unless you update the split code on the javascript side.
     
                    //    //Note: Each combo VALUE must be unique (reported defect in RadComboBox) so I have appended the action to the
                    //    //Note:   value (No Action, Lost, Stolen or Collect) to ensure they are unique via action.
     
                    //    using (var noActionCombo = new RadComboBoxItem(TIPWebITResource.NoAction, auditDetailUIDAndTag + "|NoAction"))
                    //    {
                    //        //read comment above
                    //        noActionCombo.ToolTip = TIPWebITResource.noActionComboToolTip;
     
                    //        using (RadComboBoxItem lostCombo = new RadComboBoxItem(TIPWebITResource.Lost, auditDetailUIDAndTag + "|Lost"))
                    //        {//read comment above
                    //            lostCombo.ToolTip = TIPWebITResource.LostComboToolTip;
     
                    //            using (RadComboBoxItem stolenCombo = new RadComboBoxItem(TIPWebITResource.Stolen, auditDetailUIDAndTag + "|Stolen"))
                    //            {  //read comment above
                    //                stolenCombo.ToolTip = TIPWebITResource.stolenComboToolTip;
     
                    //                using (RadComboBoxItem collectCombo = new RadComboBoxItem(TIPWebITResource.Collect, auditDetailUIDAndTag + "|Collect"))
                    //                {
                    //                    //read comment above
                    //                    collectCombo.ToolTip = TIPWebITResource.collectComboToolTip;
                    //                    #region
     
     
                    //                    switch (LabelTagAuditState.Text)
                    //                    {
                    //                        case "Found":
                    //                            using (RadComboBoxItem statusSeparator = new RadComboBoxItem(TIPWebITResource.ChangeStatusDivider))
                    //                            {
                    //                                actions.Visible = false;
                    //                                actions.Enabled = false;
                    //                            }
                    //                            break;
                    //                        case "Missing":
                    //                            switch (user.UserRole)
                    //                            {
                    //                                case UserRole.SiteViewAdmin:
                    //                                    //GET THE DISTRICT PREFERENCES THAT WILL AFFECT THE VIEW
                    //                                    //if (this.SiteViewAdminRestrictReconcilingRoomAuditResults)
                    //                                    //{
                    //                                    //    // Item is checked
                    //                                    //    actions.Visible = false;
                    //                                    //    return;
                    //                                    //}
                    //                                    //using (RadComboBoxItem statusSeparator = new RadComboBoxItem(TIPWebITResource.ChangeStatusDivider))
                    //                                    //{
                    //                                    //    actions.Items.Add(noActionCombo);
                    //                                    //    statusSeparator.IsSeparator = true;
                    //                                    //    actions.Items.Add(statusSeparator);
                    //                                    //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.Lost, TIPWebITResource.Lost));
                    //                                    //    actions.Enabled = true;
                    //                                    //}
     
                    //                                    break;
                    //                                case UserRole.SiteViewUser:
                    //                                    //if (this.SiteViewUserRestrictReconcilingRoomAuditResults)
                    //                                    //{
                    //                                    //    // Item is checked
                    //                                    //    actions.Visible = false;
                    //                                    //    return;
                    //                                    //}
                    //                                    //using (RadComboBoxItem statusSeparator = new RadComboBoxItem(TIPWebITResource.ChangeStatusDivider))
                    //                                    //{
                    //                                    //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.NoAction, TIPWebITResource.NoAction));
                    //                                    //    statusSeparator.IsSeparator = true;
                    //                                    //    actions.Items.Add(statusSeparator);
                    //                                    //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.Lost, TIPWebITResource.Lost));
                    //                                    //    actions.Enabled = true;
                    //                                    //}
                    //                                    break;
                    //                                case UserRole.AdministrativeViewAdmin:
                    //                                case UserRole.AdministrativeViewUser:
                    //                                    using (RadComboBoxItem statusSeparator = new RadComboBoxItem(TIPWebITResource.ChangeStatusDivider))
                    //                                    {
                    //                                        actions.Items.Add(noActionCombo);
                    //                                        statusSeparator.IsSeparator = true;
                    //                                        actions.Items.Add(statusSeparator);
     
                    //                                        actions.Items.Add(lostCombo);
                    //                                        actions.Items.Add(stolenCombo);
                    //                                        actions.Enabled = true;
                    //                                    }
                    //                                    break;
     
     
                    //                            }
     
                    //                            break;
                    //                        case "Misplaced":
     
                    //                            switch (user.UserRole)
                    //                            {
                    //                                case UserRole.SiteViewAdmin:
                    //                                    //GET THE DISTRICT PREFERENCES THAT WILL AFFECT THE VIEW
                    //                                    //if (this.SiteViewAdminRestrictReconcilingRoomAuditResults)
                    //                                    //{
                    //                                    //    // Item is checked
                    //                                    //    actions.Visible = false;
                    //                                    //    return;
                    //                                    //}
                    //                                    //using (RadComboBoxItem locationSeparator = new RadComboBoxItem(TIPWebITResource.ChangeLocationDivider))
                    //                                    //{
                    //                                    //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.NoAction, TIPWebITResource.NoAction));
                    //                                    //    locationSeparator.IsSeparator = true;
                    //                                    //    actions.Items.Add(locationSeparator);
                    //                                    //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.Collect, TIPWebITResource.Collect));
                    //                                    //    actions.Enabled = true;
                    //                                    //}
     
                    //                                    break;
                    //                                case UserRole.SiteViewUser:
                    //                                    //if (this.SiteViewUserRestrictReconcilingRoomAuditResults)
                    //                                    //{
                    //                                    //    // Item is checked
                    //                                    //    actions.Visible = false;
                    //                                    //    return;
                    //                                    //}
                    //                                    //using (RadComboBoxItem locationSeparator = new RadComboBoxItem(TIPWebITResource.ChangeLocationDivider))
                    //                                    //{
                    //                                    //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.NoAction, TIPWebITResource.NoAction));
                    //                                    //    locationSeparator.IsSeparator = true;
                    //                                    //    actions.Items.Add(locationSeparator);
                    //                                    //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.Collect, TIPWebITResource.Collect));
                    //                                    //    actions.Enabled = true;
                    //                                    //}
                    //                                    break;
                    //                                case UserRole.AdministrativeViewAdmin:
                    //                                case UserRole.AdministrativeViewUser:
                    //                                    actions.Visible = false;
                    //                                    actions.Enabled = false;
                    //                                    //using (RadComboBoxItem locationSeparator = new RadComboBoxItem(TIPWebITResource.ChangeLocationDivider))
                    //                                    //{
                    //                                    //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.NoAction, TIPWebITResource.NoAction));
                    //                                    //    locationSeparator.IsSeparator = true;
                    //                                    //    actions.Items.Add(locationSeparator);
                    //                                    //    actions.Items.Add(collectCombo);
                    //                                    //    actions.Enabled = true;
     
     
     
                    //                                    //}
                    //                                    break;
     
                    //                            }
     
                    //                            break;
                    //                        default:
                    //                            actions.Visible = false;
                    //                            actionLabel.Text = TIPWebITResource.Space;
                    //                            actionLabel.Visible = true;
                    //                            break;
                    //                    }
                    //                    #endregion
                    //                }
                    //            }
                    //        }
                    //    }
                    //}
                }
            }
     
            private static void ConfigureradComboBoxActions(GridItemEventArgs e, Label LabelTagAuditState,
                                                            RadComboBox radComboBoxActions, User user, Label actionLabel)
            {
                GridDataItem item = (GridDataItem)e.Item;
                string auditDetailRoomUID = item.OwnerTableView.DataKeyValues[item.ItemIndex]["auditDetailRoomUID"].ToString();
                string auditDetailUID = item.OwnerTableView.DataKeyValues[item.ItemIndex]["auditDetailUID"].ToString();
                string tag = item.OwnerTableView.DataKeyValues[item.ItemIndex]["Tag"].ToString();
     
     
                string auditDetailUIDAndTag = string.Format(CultureInfo.InvariantCulture, "{0}|{1}|{2}", auditDetailUID,
                                                            auditDetailRoomUID, tag);
     
                //I am using the value in the combo's to pass an array of data I am using for my ajax web method.
                //Do not change the order unless you update the split code on the javascript side.
     
                //Note: Each combo VALUE must be unique (reported defect in RadComboBox) so I have appended the action to the
                //Note:   value (No Action, Lost, Stolen or Collect) to ensure they are unique via action.
     
                using (var noActionCombo = new RadComboBoxItem(TIPWebITResource.NoAction, auditDetailUIDAndTag + "|NoAction"))
                {
                    //read comment above
                    noActionCombo.ToolTip = TIPWebITResource.noActionComboToolTip;
     
                    using (RadComboBoxItem lostCombo = new RadComboBoxItem(TIPWebITResource.Lost, auditDetailUIDAndTag + "|Lost"))
                    {
                        //read comment above
                        lostCombo.ToolTip = TIPWebITResource.LostComboToolTip;
     
                        using (
                            RadComboBoxItem stolenCombo = new RadComboBoxItem(TIPWebITResource.Stolen,
                                                                              auditDetailUIDAndTag + "|Stolen"))
                        {
                            //read comment above
                            stolenCombo.ToolTip = TIPWebITResource.stolenComboToolTip;
     
                            using (
                                RadComboBoxItem collectCombo = new RadComboBoxItem(TIPWebITResource.Collect,
                                                                                   auditDetailUIDAndTag + "|Collect"))
                            {
                                //read comment above
                                collectCombo.ToolTip = TIPWebITResource.collectComboToolTip;
     
                                #region
     
                                switch (LabelTagAuditState.Text)
                                {
                                    case "Found":
                                        using (
                                            RadComboBoxItem statusSeparator =
                                                new RadComboBoxItem(TIPWebITResource.ChangeStatusDivider))
                                        {
                                            radComboBoxActions.Visible = false;
                                            radComboBoxActions.Enabled = false;
                                        }
                                        break;
                                    case "Missing":
                                        switch (user.UserRole)
                                        {
                                            case UserRole.SiteViewAdmin:
                                                //GET THE DISTRICT PREFERENCES THAT WILL AFFECT THE VIEW
                                                //if (this.SiteViewAdminRestrictReconcilingRoomAuditResults)
                                                //{
                                                //    // Item is checked
                                                //    actions.Visible = false;
                                                //    return;
                                                //}
                                                //using (RadComboBoxItem statusSeparator = new RadComboBoxItem(TIPWebITResource.ChangeStatusDivider))
                                                //{
                                                //    actions.Items.Add(noActionCombo);
                                                //    statusSeparator.IsSeparator = true;
                                                //    actions.Items.Add(statusSeparator);
                                                //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.Lost, TIPWebITResource.Lost));
                                                //    actions.Enabled = true;
                                                //}
     
                                                break;
                                            case UserRole.SiteViewUser:
                                                //if (this.SiteViewUserRestrictReconcilingRoomAuditResults)
                                                //{
                                                //    // Item is checked
                                                //    actions.Visible = false;
                                                //    return;
                                                //}
                                                //using (RadComboBoxItem statusSeparator = new RadComboBoxItem(TIPWebITResource.ChangeStatusDivider))
                                                //{
                                                //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.NoAction, TIPWebITResource.NoAction));
                                                //    statusSeparator.IsSeparator = true;
                                                //    actions.Items.Add(statusSeparator);
                                                //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.Lost, TIPWebITResource.Lost));
                                                //    actions.Enabled = true;
                                                //}
                                                break;
                                            case UserRole.AdministrativeViewAdmin:
                                            case UserRole.AdministrativeViewUser:
                                                using (
                                                    RadComboBoxItem statusSeparator =
                                                        new RadComboBoxItem(TIPWebITResource.ChangeStatusDivider))
                                                {
                                                    radComboBoxActions.Items.Add(noActionCombo);
                                                    statusSeparator.IsSeparator = true;
                                                    radComboBoxActions.Items.Add(statusSeparator);
     
                                                    radComboBoxActions.Items.Add(lostCombo);
                                                    radComboBoxActions.Items.Add(stolenCombo);
                                                    radComboBoxActions.Enabled = true;
                                                    radComboBoxActions.Visible = true;
                                                }
                                                break;
                                        }
     
                                        break;
                                    case "Misplaced":
     
                                        switch (user.UserRole)
                                        {
                                            case UserRole.SiteViewAdmin:
                                                //GET THE DISTRICT PREFERENCES THAT WILL AFFECT THE VIEW
                                                //if (this.SiteViewAdminRestrictReconcilingRoomAuditResults)
                                                //{
                                                //    // Item is checked
                                                //    actions.Visible = false;
                                                //    return;
                                                //}
                                                //using (RadComboBoxItem locationSeparator = new RadComboBoxItem(TIPWebITResource.ChangeLocationDivider))
                                                //{
                                                //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.NoAction, TIPWebITResource.NoAction));
                                                //    locationSeparator.IsSeparator = true;
                                                //    actions.Items.Add(locationSeparator);
                                                //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.Collect, TIPWebITResource.Collect));
                                                //    actions.Enabled = true;
                                                //}
     
                                                break;
                                            case UserRole.SiteViewUser:
                                                //if (this.SiteViewUserRestrictReconcilingRoomAuditResults)
                                                //{
                                                //    // Item is checked
                                                //    actions.Visible = false;
                                                //    return;
                                                //}
                                                //using (RadComboBoxItem locationSeparator = new RadComboBoxItem(TIPWebITResource.ChangeLocationDivider))
                                                //{
                                                //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.NoAction, TIPWebITResource.NoAction));
                                                //    locationSeparator.IsSeparator = true;
                                                //    actions.Items.Add(locationSeparator);
                                                //    actions.Items.Add(new RadComboBoxItem(TIPWebITResource.Collect, TIPWebITResource.Collect));
                                                //    actions.Enabled = true;
                                                //}
                                                break;
                                            case UserRole.AdministrativeViewAdmin:
                                            case UserRole.AdministrativeViewUser:
                                                using (
                                                   RadComboBoxItem statusSeparator =
                                                       new RadComboBoxItem(TIPWebITResource.ChangeStatusDivider))
                                                {
                                                    radComboBoxActions.Items.Add(noActionCombo);
                                                    statusSeparator.IsSeparator = true;
                                                    radComboBoxActions.Items.Add(statusSeparator);
     
                                                    radComboBoxActions.Items.Add(collectCombo);
                                                    radComboBoxActions.Enabled = true;
                                                    radComboBoxActions.Visible = true;
                                                }
                                                break;
                                        }
     
                                        break;
                                    default:
                                        radComboBoxActions.Visible = false;
                                        actionLabel.Text = TIPWebITResource.Space;
                                        actionLabel.Visible = true;
                                        break;
                                }
     
                                #endregion
                            }
                        }
                    }
                }
            }
     
            protected void RadGridAudits_ItemCreated(object sender, GridItemEventArgs e)
            {
                if (e == null)
                {
                    return;
                }
                if (e == null) return;
                //var user = (User)Session["currentUser"];
                //switch (user.UserRole)
                //{
                //case UserRole.SiteViewAdmin:
                //    ConfigureGridSiteViewAdmin(e.Item);
                //    break;
                //case UserRole.SiteViewUser:
                //    ConfigureGridSiteViewUser(e.Item);
                //    break;
                //case UserRole.AdministrativeViewAdmin:
                //    ConfigureGridAdministrativeViewAdmin(e.Item);
                //    break;
                //case UserRole.AdministrativeViewUser:
                //    ConfigureGridAdministrativeViewUser(e.Item);
                //    break;
     
                //}
            }
     
            protected void RadGridAudits_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
            {
                RadGridAudits.DataSource = GetAuditData();
            }
     
     
        }
     
    }



  5. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1968 posts

    Posted 27 Mar 2013 Link to this post

    Hello,

    It seems that the provided implementation for unchecking RadComboBox check boxes will not uncheck the "Check All" in some previous versions of our control. Therefore I would suggest adding the following line of code to your clearCheckedItems function as shown:
    //JavaScript
    function clearCheckedItems (combo) {
        var $ = $telerik.$;
        for (var i = 0; i < combo.get_items().get_count() ; i++) {
            combo.get_items().getItem(i).set_checked(false);
        }
        var checkAllCheckBox = $(".rcbCheckAllItemsCheckBox");
        checkAllCheckBox.attr("checked", false);
    }


    All the best,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top