<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/FiniqAppMasterPage.Master" CodeBehind="Dealer_Book_Mapping.aspx.vb" Inherits="FinIQWebApp.Dealer_Book_Mapping" MaintainScrollPositionOnPostback="true"
    Title="Dealer Branch Mapping" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <script src="Dealer_BookMapping.js" type="text/javascript">

    </script>
    <style>
        .MarginLeft {
            margin-left: 3px;
        }
    </style>

    <script type="text/javascript">
        function disable(check) {

            if (check.checked == false) {

                $("#ctl00_MainContent_dgUnmappedBooks_ctl02_chksearchUnmappedbook").attr('checked', false);
            }

        }

        function disableUnmappedDealer(check) {

            if (check.checked == false) {

                $("#ctl00_MainContent_dgUnMappedDealer_ctl02_chksearchUnmappedDealer").attr('checked', false);
            }

        }

        function disableBooks(check) {

            if (check.checked == false) {

                $("#ctl00_MainContent_dgSearchBooks_ctl02_chksearchbook").attr('checked', false);
            }

        }

        function SelectALL(CheckBoxControl) {
            if (CheckBoxControl.checked == true) {
                var i;
                for (i = 0; i < document.forms[0].elements.length; i++) {
                    if ((document.forms[0].elements[i].type == 'checkbox') &&
                (document.forms[0].elements[i].name.indexOf('dgSearchDealer') > -1)) {
                        document.forms[0].elements[i].checked = true;
                    }

                }
            }
            else {
                var i;
                for (i = 0; i < document.forms[0].elements.length; i++) {
                    if ((document.forms[0].elements[i].type == 'checkbox') &&
                (document.forms[0].elements[i].name.indexOf('dgSearchDealer') > -1)) {
                        document.forms[0].elements[i].checked = false;
                    }

                }
            }

        }

        function DeSelectALL() {
            var i;
            for (i = 0; i < document.forms[0].elements.length; i++) {
                if ((document.forms[0].elements[i].type == 'checkbox') &&
                (document.forms[0].elements[i].name.indexOf('chkAllItems') > -1)) {
                    document.forms[0].elements[i].checked = false;
                }

            }

        }
        //



        function DeSelectALLBookNew() {
            var i;
            alert("Check");
            for (i = 0; i < document.forms[0].elements.length; i++) {
                alert("Check");
                if ((document.forms[0].elements[i].type == 'checkbox') &&
                (document.forms[0].elements[i].name.indexOf('chksearchUnmappedbook') > -1)) {
                    document.forms[0].elements[i].checked = false;
                }

            }

        }


        function BeforePostbackScroll() {
            document.getElementById('<%= savePosition.ClientID %>').value = document.getElementById('<%= lstDealer.ClientID%>').scrollTop;
        }
        function AfterPostScroll() {
            if (document.getElementById('<%= savePosition.ClientID %>').value.length > 0) {
                document.getElementById('<%= lstDealer.ClientID%>').scrollTop = parseInt(document.getElementById('<%= savePosition.ClientID %>').value);
            }
        }
        var dialogConfirmed = false;
        function ViewDialogDuplicate(obj, title, dialogText) {
            if ($("#pageName").html() != null) {
            }
            if (!dialogConfirmed) {
                //  $('html').append(String.Format("<div id='dialog' title='{0}'><p style='float:left;'><span class='ui-icon ui-icon-alert' style='float:left; margin:0 5px 20px 0;'></span>{1}</p></div>", title, dialogText));
                $('html').append(String.Format("<div id='dialog' title='{0}'><div class='infoConfirmationBox' style='float:left; height:22px !important; width:22px !important; margin: 13px 15px 20px 10px;'></div><p> " + dialogText + " </p></div>", title));
                $('#dialog').dialog
                        ({
                            height: 180,
                            width: 350,
                            modal: true,
                            resizable: false,
                            draggable: true,
                            close: function (event, ui) { $('html').find('#dialog').remove(); },
                            buttons:
                            {
                                'Yes': function () {
                                    if (obj == "btnhdnUnMapped") {
                                        $("#ctl00_MainContent_btnhdnUnMapped").click();
                                    }
                                    else if (obj == "btnhdnDUnMapped") {
                                        $("#ctl00_MainContent_btnhdnDUnMapped").click();
                                    }
                                    else if (obj == "btnhdnMapped") {
                                        $("#ctl00_MainContent_btnhdnMapped").click();
                                    }
                                    else if (obj == "btnhdnDMapped") {
                                        $("#ctl00_MainContent_btnhdnDMapped").click();
                                    }
                                    //else
                                    //{
                                    //    $("#ctl00_MainContent_btnhdnDMapped").click();
                                    //}

                                    $(this).dialog('close');
                                },
                                'No': function () {
                                    $(this).dialog('close');
                                    $('html').find("#dialog").remove();
                                    return false;
                                }
                            }
                        });
            }

            return dialogConfirmed;
            $(".ui-widget-overlay").height($("body").height());
        }
        //Changed by Akanksha P on 29-10-18
        function AllowAlphaNumericSpecialCharOnly() {
            try {


                var keycode;
                if (window.event)
                    keycode = window.event.keyCode;
                else if (event)
                    keycode = event.keyCode;
                else if (e)
                    keycode = e.which;
                else return true;
                if ((keycode == 60) || (keycode == 62) || (keycode == 63)) {

                    return false;

                }
                else {
                    return true;
                }
                return true;

            } catch (err) {
                console.log(err.message)
            }
        }

        //Change end

        //start-change done by Shreya A. on 31-10-2018

        function EnterKeySearchByDealerName(evt) {
            var code = (evt.which) ? evt.which : evt.keyCode;

            if (code == 13 || code == 9) {
                document.getElementById('<%=btnDealerFind.ClientID%>').click();
            }
        }

        function EnterKeySearchByUBook(evt) {
            var code = (evt.which) ? evt.which : evt.keyCode;

            if (code == 13 || code == 9) {
                document.getElementById('<%=btnfindUbook.ClientID%>').click();
            }
        }

        function EnterKeySearchByBook(evt) {
            var code = (evt.which) ? evt.which : evt.keyCode;

            if (code == 13 || code == 9) {
                document.getElementById('<%=btnfindbook.ClientID%>').click();
            }
        }

        function EnterKeySearchByUdealer(evt) {
            var code = (evt.which) ? evt.which : evt.keyCode;

            if (code == 13 || code == 9) {
                document.getElementById('<%=btnfindudealer.ClientID%>').click();
            }
        }

    </script>

    <script type="text/javascript">

        function scollPosition() {
            var div = "";

            div = document.getElementById("divoptradio").scrollTop;
            localStorage.setItem("scrollPosition", div);

            // alert(div)

        }

        $(function () {


            if (localStorage.getItem("scrollPosition") != undefined && localStorage.getItem("scrollPosition") != null) {
                $("#divoptradio").scrollTop(localStorage.getItem("scrollPosition"));
            }



        })

    </script>



    <%--<script>
            window.onload = function () {
                var rr = [];
                var list = document.getElementById("<%=lstDealer.ClientID%>");
                $("#ctl00_MainContent_lstDealer :selected").each(function (i, selected) {

                if (Number($(selected).index()) < 35) {

                    $("#ctl00_MainContent_lstDealer").scrollTop(0);

                } else {
                    $("#ctl00_MainContent_lstDealer").scrollTop($(list).prop("scrollHeight"));

                }
            });

        }

        var parameter = Sys.WebForms.PageRequestManager.getInstance();

        parameter.add_endRequest(function () {

            var rr = [];
            var list = document.getElementById("<%=lstDealer.ClientID%>");
            $("#ctl00_MainContent_lstDealer :selected").each(function (i, selected) {
             if (Number($(selected).index()) < 35) {

                 $("#ctl00_MainContent_lstDealer").scrollTop(0);

             } else {
                 $("#ctl00_MainContent_lstDealer").scrollTop($(list).prop("scrollHeight"));

             }
         });


     });
    </script>--%>

    <%--   //end-change done by Shreya A. on 31-10-2018--%>

    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <table>

                <tr>
                    <td style="height: 15px !important;">
                        <asp:Label ID="lblError" runat="server" CssClass="lblerror"></asp:Label>
                        <asp:Label ID="lblWarning" runat="server" CssClass="lblinfo"></asp:Label>
                        <asp:Label ID="lblInfo" runat="server" CssClass="lblsuccess"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table>
                            <tr>
                                <td class="lblBlotterPaddingRight">
                                    <asp:Label ID="Label2" runat="server" CssClass="lbl MarginLeft" Text="Home Entity"> </asp:Label>
                                </td>
                                <td class="lblBlotterPaddingRight">
                                    <asp:Label ID="lblHomeEntity" runat="server"></asp:Label>
                                </td>
                                <td></td>
                            </tr>
                            <tr>
                                <td class="lblBlotterPaddingRight">
                                    <asp:Label ID="Label1" runat="server" Text="<%$ Resources:LocalizedText, Entity %>" CssClass="lbl MarginLeft"></asp:Label>

                                </td>
                                <td class="lblBlotterPaddingRight">
                                    <asp:DropDownList ID="ddlEntity" runat="server" CssClass="ddl" AutoPostBack="True"
                                        Height="29px" Width="153px"> <%--Changes added Varun Patyal for UBPINT-1145 on 6th July 2021--%>
                                    </asp:DropDownList>

                                </td>
                                <td class="lblBlotterPaddingRight">
                                    <asp:Button ID="btnMapped" runat="server" CssClass="btn" Text="Map" Width="70px"
                                        ToolTip="Map selected Branch to Dealer" />
                                    <%-- OnClientClick="myconfirmbox('Are you sure, you want to map selected Branch to Dealer ?')" />--%>
                                    <asp:Button ID="btnDMapped" runat="server" CssClass="btn" Text="Map" Width="70px"
                                        ToolTip="Map selected Dealer(s) to Branch" />
                                    <%-- OnClientClick="myconfirmbox('Are you sure, you want to map selected Dealer(s) to Branch ?');" />--%>
                                </td>



                            </tr>
                            <tr>
                                <td class="lblBlotterPaddingRight">
                                    <asp:Label ID="Label3" runat="server" CssClass="lbl MarginLeft">  Mode </asp:Label>

                                </td>
                                <td class="lblBlotterPaddingRight">


                                    <asp:DropDownList ID="ddlType" runat="server" CssClass="ddl" AutoPostBack="True"
                                        ToolTip="Select mode (Dealer/Branch) " Height="29px" Width="153px"> <%--Changes added Varun Patyal for UBPINT-1145 on 6th July 2021--%>
                                         <asp:ListItem Value="1">Branch</asp:ListItem>
                                        <asp:ListItem Value="0">Dealer</asp:ListItem>                                  
                                    </asp:DropDownList>

                                </td>

                                <%--  <td>
                                    <div style="text-align: right">
                                        <asp:Label ID="Label4" runat="server" CssClass="lbl" Text="Action :"></asp:Label>
                                    </div>


                                </td>--%>
                                <td class="lblBlotterPaddingRight">


                                    <asp:Button ID="btnUnMapped" runat="server" CssClass="btn" Text="Unmap" Width="70px"
                                        ToolTip="Unmap selected Branch from Dealer" />
                                    <%--OnClientClick="myconfirmbox('Are you sure, you want to unmap selected Branch from Dealer ?');" />--%>

                                    <asp:Button ID="btnDUnMapped" runat="server" CssClass="btn" Text="Unmap" Width="70px"
                                        ToolTip="Unmap selected Dealer(s) from Branch" />
                                    <%-- OnClientClick="myconfirmbox(' Are you sure, you want to unmap selected Dealer(s) from Branch ?');" />--%>

                                </td>

                            </tr>

                        </table>
                    </td>
                </tr>
                <tr>
                    <td >
                        <asp:Label runat ="server" Text ="Details" CssClass="background_gray" style="border-bottom: 0px; margin-left :5px;"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table class="tbl" id="tblDealer" runat="server" style="width: 100%" visible="false">
                            <tr>
                                <td nowrap>
                                    <asp:CheckBox ID="chkDealerAllSearch" runat="server" Text="All Dealer(s)" AutoPostBack="True"
                                        Checked="True" ToolTip="Show all Dealer(s)" />

                                    <asp:Button ID="btnDealerSearch" runat="server" Text="Find" CssClass="btn" Width="70px" Style="float: right;"
                                        Enabled="False" ToolTip="Search  Dealer(s)" />
                                    <asp:Panel ID="PnlSearchDealer" Style="position: absolute; top: 240px; left: 190px; padding: 5px; height: 450px; width: 450px;"
                                        runat="server" CssClass="Filter" ScrollBars="Auto" Visible="False">
                                        <%--ScrollBars="Both"--%>
                                        <table class="tbl">
                                            <tr>
                                                <td>
                                                    <asp:Label runat="server" Text="Dealer List" CssClass="lbl"></asp:Label>
                                                </td>
                                                <td style="float: right;">
                                                    <asp:Button ID="btnClose" runat="server" CssClass="btn" Text="X" Width="25" Height="25px"
                                                        ToolTip="close" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 10px;" colspan="2"></td>
                                            </tr>

                                            <tr>
                                                <td colspan="2">
                                                    <table>
                                                        <tr>
                                                            <td class="lblBlotterPaddingRight">
                                                                <asp:Label runat="server" CssClass="lbl" Text="Dealer Name">

                                                                </asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="txtDealerName" runat="server" CssClass="txt" Width="121px" onkeydown="EnterKeySearchByDealerName(event)" onkeypress="return AllowAlphaNumericSpecialCharOnly()"></asp:TextBox>
                                                                <%--Changed by Akanksha P--%>
                                                            </td>
                                                            <td>
                                                                <asp:Button ID="btnDealerFind" runat="server" Text="Find" Width="70px" ToolTip="search Dealer(s)"
                                                                    CssClass="btn"></asp:Button>

                                                            </td>
                                                            <td>
                                                                <asp:Button ID="btnDealerApply" runat="server" Text="Apply" Width="70px" ToolTip="Add selected Dealer(s)"
                                                                    CssClass="btn" />
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 4px;" colspan="2"></td>
                                            </tr>
                                        </table>
                                        <table>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblSearchDealer" runat="server" CssClass="lblinfo_panel"></asp:Label></td>
                                            </tr>
                                        </table>
                                        <table class="tbl">
                                            <tr>
                                                <td nowrap>


                                                    <asp:GridView ID="dgSearchDealer" runat="server" AutoGenerateColumns="False" CssClass="Grid"
                                                        BorderStyle="None" AllowPaging="True" PageSize="10" Width="300px">
                                                        <SelectedRowStyle CssClass="GridItemSelect" />
                                                        <RowStyle CssClass="GridItem" />
                                                        <HeaderStyle CssClass="GridHeader" />
                                                        <FooterStyle CssClass="GridFooter" />
                                                        <PagerStyle CssClass="GridPager" />

                                                        <Columns>
                                                            <asp:TemplateField>
                                                                <HeaderStyle HorizontalAlign="center" />
                                                                <ItemStyle HorizontalAlign="Center" />
                                                                <HeaderTemplate>
                                                                    <asp:CheckBox ID="chkAllItems" runat="server" OnCheckedChanged="chkAllItems_CheckedChanged" AutoPostBack="true"
                                                                        Style="margin-left: -3px;" />

                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:CheckBox ID="chkSelectedDealer" runat="server" OnCheckedChanged="chkSelectedDealer_CheckedChanged" AutoPostBack="true" />
                                                                </ItemTemplate>

                                                            </asp:TemplateField>

                                                            <asp:TemplateField HeaderText="SR.No"></asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Dealer ID">
                                                                <ItemStyle HorizontalAlign="right" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblDealerId" runat="server" Text='<%# Eval("DealerId")%>'>
                                                                    </asp:Label>
                                                                </ItemTemplate>
                                                                <ItemStyle HorizontalAlign="Right" Width="20px" />
                                                            </asp:TemplateField>

                                                            <asp:TemplateField HeaderText="Dealer Name">
                                                                <ItemTemplate>
                                                                    <itemstyle wrap="True" word-wrap="break-word"></itemstyle>
                                                                    <asp:Label ID="lblDealerName" runat="server" Text='<%# Eval("DealerName")%>'>
                                                                    </asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>


                                                        </Columns>
                                                        <%--     <PagerStyle Mode="NumericPages" />--%>
                                                    </asp:GridView>

                                                </td>
                                            </tr>
                                        </table>
                                    </asp:Panel>
                                </td>
                                <td style="width: 50px"></td>

                                <td nowrap="nowrap">
                                    <asp:CheckBox ID="chkUnMappedBooks" runat="server" Text="All Unmapped Branch(es)" AutoPostBack="True"
                                        TabIndex="9" ToolTip="show unmapped Branch(es) for selected Dealer" />

                                    <asp:Button ID="btnSearchUnMappedBooks" runat="server" Text="Find" CssClass="btn" Style="float: right;"
                                        Width="70px" Enabled="False" ToolTip="search unmapped  Branch(es) " />
                                    <asp:Panel ID="PnlSearchUnMappedBooks" Style="position: absolute; top: 240px; padding: 5px; left: 790px; height: 450px; width: 450px;"
                                        runat="server" CssClass="Filter" ScrollBars="Auto" Visible="False">
                                        <%-- ScrollBars="Both"--%>
                                        <table class="tbl">
                                            <tr>
                                                <td>
                                                    <asp:Label Text="Unmapped Branch List" runat="server" CssClass="lbl"></asp:Label>
                                                </td>
                                                <td style="float: right;">
                                                    <asp:Button ID="btncloseUbook" runat="server" CssClass="btn" Text="X" Height="25"
                                                        Width="25" ToolTip="close" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 10px;" colspan="2"></td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <table>
                                                        <tr>
                                                            <td class="lblBlotterPaddingRight">
                                                                <asp:Label Text="Branch Name" runat="server" CssClass="lbl"></asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="txtSearchUBook" runat="server" onkeydown="EnterKeySearchByUBook(event)" CssClass="txt" Width="121px"></asp:TextBox>
                                                            </td>
                                                            <td>
                                                                <asp:Button ID="btnfindUbook" runat="server" Style="float: left;" Text="Find" Width="70px" ToolTip="search Branch(es)"
                                                                    CssClass="btn"></asp:Button>
                                                            </td>
                                                            <td>
                                                                <asp:Button ID="btnapplyubook" runat="server" Style="float: left;" Text="Apply" Width="70px" ToolTip="Add selected Branch(es)"
                                                                    CssClass="btn" />
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 4px;" colspan="2"></td>
                                            </tr>
                                        </table>
                                        <table class="tbl">
                                            <tr>
                                                <td nowrap="nowrap">
                                                    <asp:Label ID="lblSearchUnmappedBook" runat="server" CssClass="lblinfo_panel" Style="padding: 5px !important;"></asp:Label>
                                                </td>
                                            </tr>
                                        </table>
                                        <table class="tbl">
                                            <tr>
                                                <td>
                                                    <asp:GridView ID="dgUnmappedBooks" runat="server" AutoGenerateColumns="False" CssClass="Grid"
                                                        BorderStyle="None" AllowPaging="True" PageSize="10" Width="318px">
                                                        <SelectedRowStyle CssClass="GridItemSelect" />
                                                        <RowStyle CssClass="GridItem" />
                                                        <HeaderStyle CssClass="GridHeader" />
                                                        <FooterStyle CssClass="GridFooter" />
                                                        <PagerStyle CssClass="GridPager" />
                                                        <Columns>
                                                            <asp:TemplateField>
                                                                <HeaderStyle HorizontalAlign="Right" />
                                                                <ItemStyle HorizontalAlign="Center" Width="20px" />
                                                                <HeaderTemplate>
                                                                    <asp:CheckBox ID="chksearchUnmappedbook" runat="server" OnCheckedChanged="chkAll_CheckedChanged" AutoPostBack="true" />
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:CheckBox ID="chkSelectedUbook" class="innercheck" OnCheckedChanged="chkGrid_CheckedChanged" runat="server" AutoPostBack="true"></asp:CheckBox>
                                                                </ItemTemplate>

                                                            </asp:TemplateField>


                                                            <asp:TemplateField HeaderText="SR.No">
                                                                <ItemStyle Wrap="False" HorizontalAlign="Right"></ItemStyle>
                                                                <FooterStyle HorizontalAlign="Center" />
                                                                <HeaderStyle HorizontalAlign="Center" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Branch ID">
                                                                <ItemStyle HorizontalAlign="Right" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblBookId" runat="server" Text='<%# Eval("BookId")%>'>
                                                                    </asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>


                                                            <asp:TemplateField HeaderText="Branch Name">

                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblBookName" runat="server" Text='<%# Eval("BookName")%>' />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>


                                                        </Columns>
                                                        <%--    <PagerStyle Mode="NumericPages" />--%>
                                                    </asp:GridView>
                                                </td>
                                            </tr>
                                        </table>
                                    </asp:Panel>
                                </td>
                            </tr>

                            <tr>
                                <td style="height: 5px"></td>
                            </tr>
                            <tr>
                                <td>
                                   <asp:Label runat ="server" Text="Dealer(s)" CssClass ="lbl MarginLeft" ></asp:Label>
                                </td>
                                <td > 
                                    <asp:Label ID="Label4" runat ="server" Text="Mapped Branch" CssClass ="lbl" ></asp:Label>
                                </td>
                                <td >
                                    <asp:Label ID="Label5" runat ="server" Text="Unmapped Branch(es)" CssClass ="lbl" ></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>

                                    <asp:Panel ID="PnlDealer" runat="server" Height="450px" Width="246px" onScroll="scollPosition();">
                                        <%-- Added by Shreya A. on 31-10-2018--%>
                                        <asp:ListBox ID="lstDealer" runat="server" SelectionMode="Single" AutoPostBack="true" CssClass="lst MarginLeft"
                                            Width="243" Height="100%" ToolTip="select Dealer to get mapped and unmapped Branch(es)"></asp:ListBox>
                                    </asp:Panel>
                                </td>
                                <td>
                                    <asp:Panel ID="PnlMapped" runat="server" ScrollBars="Both" Width="246px" Height="450px" Style="overflow-x: hidden"
                                        CssClass="Filter">
                                        <asp:ListBox ID="chkbDealerMappedBook" runat="server"  Height="97%" Width="100%" AutoPostBack="true" Style="border: none !important;" RepeatLayout="Flow"></asp:ListBox>
                                    </asp:Panel>
                                </td>
                                <td>
                                    <asp:Panel ID="PnlUnMapped" runat="server" ScrollBars="Vertical" CssClass="Filter"
                                        Width="246px" Height="450px">
                                        <asp:RadioButtonList ID="chkDealerUnMappedBook" runat="server" Height="97%" RepeatLayout="Flow" AutoPostBack ="true"
                                            Width="100%">
                                        </asp:RadioButtonList>
                                    </asp:Panel>
                                </td>
                            </tr>
                        </table>


                        <table class="tbl" id="tblBooks" runat="server" visible="false">
                            <%--           <tr>
                        <td style="height: 5px"></td>
                    </tr>--%>
                            <tr>
                                <td width="35%" nowrap="nowrap">
                                    <asp:CheckBox ID="chkBooksAllSearch" runat="server" Text="All Branch(es)" AutoPostBack="True"
                                        ToolTip="show All Branch(es)" />

                                    <asp:Button ID="btnSearchBooks" runat="server" Text="Find" CssClass="btn" Width="70px" Style="float: right;"
                                        Enabled="False" ToolTip="search Branche(s)" />
                                    <asp:Panel ID="PnlSearchBooks" Style="position: absolute; top: 245px; padding: 5px; left: 190px; height: 450px; width: 450px;"
                                        runat="server" ScrollBars="Auto" CssClass="Filter"
                                        Visible="False">
                                        <%--ScrollBars="Both"--%>
                                        <table class="tbl">
                                            <tr>
                                                <td class="lbl" style="padding: 5px !important;" colspan="4">Branch List
                                                </td>
                                                <td style="float: right;">
                                                    <asp:Button ID="btnclosebooklist" runat="server" CssClass="btn" Height="25" Text="X"
                                                        Width="25" ToolTip="close" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 10px;" colspan="2"></td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <table>
                                                        <tr>
                                                            <td class="lbl lblBlotterPaddingRight">Branch Name
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="txtsearchbook" runat="server" onkeydown="EnterKeySearchByBook(event)" CssClass="txt" Width="121px"></asp:TextBox>
                                                            </td>
                                                            <td>
                                                                <asp:Button ID="btnfindbook" runat="server" Text="Find" Width="70px" CssClass="btn"
                                                                    ToolTip="search Branch(es)"></asp:Button>
                                                            </td>
                                                            <td>
                                                                <asp:Button ID="btnapply" runat="server" Text="Apply" Width="70px" ToolTip="Add selected Branch(es)"
                                                                    CssClass="btn" />
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 4px;" colspan="2"></td>
                                            </tr>
                                        </table>
                                        <table class="tbl">
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblsearchbookerror" runat="server" CssClass="lblinfo_panel" Style="padding: 5px !important;"></asp:Label>
                                                </td>
                                            </tr>
                                        </table>
                                        <table class="tbl">
                                            <tr>
                                                <td>

                                                    <asp:GridView ID="dgSearchBooks" runat="server" AutoGenerateColumns="False" CssClass="Grid"
                                                        BorderStyle="None" AllowPaging="True" PageSize="10" Width="108px">
                                                        <SelectedRowStyle CssClass="GridItemSelect" />
                                                        <RowStyle CssClass="GridItem" />
                                                        <HeaderStyle CssClass="GridHeader" />
                                                        <FooterStyle CssClass="GridFooter" />
                                                        <PagerStyle CssClass="GridPager" />

                                                        <Columns>
                                                            <asp:TemplateField>
                                                                <HeaderStyle HorizontalAlign="Right" />
                                                                <ItemStyle HorizontalAlign="Center" />
                                                                <HeaderTemplate>
                                                                    <asp:CheckBox ID="chksearchbook" runat="server" OnCheckedChanged="chksearchbook_CheckedChanged" AutoPostBack="true" />
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:CheckBox ID="chkSelectedBooks" class="innercheck" OnCheckedChanged="chkSelectedBooks_CheckedChanged" runat="server" AutoPostBack="true"></asp:CheckBox>
                                                                </ItemTemplate>

                                                            </asp:TemplateField>


                                                            <asp:TemplateField HeaderText="SR.No">
                                                                <ItemStyle HorizontalAlign="Right" Width="10"></ItemStyle>
                                                                <HeaderStyle HorizontalAlign="Center" Width="10" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Branch ID">
                                                                <ItemStyle HorizontalAlign="Right" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblBookId" runat="server" Text='<%# Eval("BookId")%>'> </asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Branch Name">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblBookName" runat="server" Text='<%# Eval("BookName")%>'> </asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>


                                                        </Columns>
                                                        <%--    <PagerStyle Mode="NumericPages" />--%>
                                                    </asp:GridView>
                                                </td>
                                            </tr>
                                        </table>
                                    </asp:Panel>
                                </td>
                                <td nowrap="nowrap"></td>
                                <td nowrap="nowrap">
                                    <asp:CheckBox ID="chkSearchUnMappedDealer" runat="server" Text="All Unmapped Dealer(s)"
                                        AutoPostBack="True" ToolTip="show unmapped Dealer(s) for selected Branch" />

                                    <asp:Button ID="btnUnMappedDealer" runat="server" Text="Find" CssClass="btn" Width="70px" Style="float: right;"
                                        Enabled="False" ToolTip="search unmapped Dealer(s)" />
                                    <asp:Panel ID="PnlUnMappedDealer" Style="position: absolute; top: 245px; padding: 5px; left: 775px; height: 450px; width: 500px;"
                                        runat="server" CssClass="Filter" ScrollBars="Auto"
                                        Visible="False">
                                        <%--ScrollBars="Both"--%>
                                        <table class="tbl">
                                            <tr>
                                                <td class="lbl">Unmapped Dealer List
                                                </td>
                                                <td style="float: right;">
                                                    <asp:Button ID="btncloseudealer" runat="server" CssClass="btn" Height="25" Text="X"
                                                        ToolTip="close" Width="25" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 10px;" colspan="2"></td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <table>
                                                        <tr>
                                                            <td class="lblBlotterPaddingRight">
                                                                <asp:Label runat="server" ID="lblDealerName" Text="Dealer Name" CssClass="lbl">

                                                                </asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="txtUdealer" runat="server" onkeydown="EnterKeySearchByUdealer(event)" CssClass="txt" Width="121px"></asp:TextBox>
                                                            </td>
                                                            <td>
                                                                <asp:Button ID="btnfindudealer" runat="server" Text="Find" Width="70px" CssClass="btn"
                                                                    ToolTip="search Dealer(s)"></asp:Button>
                                                            </td>
                                                            <td>
                                                                <asp:Button ID="btnAddUdealer" runat="server" Text="Apply" Width="70px" ToolTip="Add selected Dealer(s)"
                                                                    CssClass="btn" />
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 4px;" colspan="2"></td>
                                            </tr>
                                        </table>
                                        <table class="tbl">
                                            <tr>
                                                <td nowrap>
                                                    <asp:Label ID="lblSearchUnMappedDealer" runat="server" CssClass="lblinfo_panel" Style="padding: 5px !important;"></asp:Label>
                                                </td>
                                            </tr>
                                        </table>
                                        <table class="tbl">
                                            <tr>
                                                <td>
                                                    <asp:GridView ID="dgUnMappedDealer" runat="server" AutoGenerateColumns="False" CssClass="Grid"
                                                        BorderStyle="None" AllowPaging="True" PageSize="10" Width="318px">
                                                        <SelectedRowStyle CssClass="GridItemSelect" />
                                                        <RowStyle CssClass="GridItem" />
                                                        <HeaderStyle CssClass="GridHeader" />
                                                        <FooterStyle CssClass="GridFooter" />
                                                        <PagerStyle CssClass="GridPager" />

                                                        <Columns>
                                                            <asp:TemplateField>
                                                                <HeaderStyle HorizontalAlign="Right" />
                                                                <ItemStyle HorizontalAlign="Center" Width="20px" />
                                                                <HeaderTemplate>
                                                                    <asp:CheckBox ID="chksearchUnmappedDealer1" runat="server" OnCheckedChanged="chksearchUnmappedDealer1_CheckedChanged" AutoPostBack="true" />
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:CheckBox ID="chkselectUDealer" class="innercheck" OnCheckedChanged="chkselectUDealer_CheckedChanged" runat="server" AutoPostBack="true"></asp:CheckBox>
                                                                </ItemTemplate>

                                                            </asp:TemplateField>


                                                            <asp:TemplateField HeaderText="SR.No">
                                                                <ItemStyle Wrap="False" HorizontalAlign="Center"></ItemStyle>
                                                                <FooterStyle HorizontalAlign="Center" />
                                                                <HeaderStyle HorizontalAlign="Center" Width="20px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Dealer ID">
                                                                <ItemStyle HorizontalAlign="Right" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblDealerId" runat="server" Text='<%# Eval("DealerId")%>' Width="80px">
                                                                    </asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>


                                                            <asp:TemplateField HeaderText="Dealer Name">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblDealerName" runat="server" Text='<%# Eval("DealerName")%>' Width="250px" Style="word-wrap: normal; word-break: break-all;">
                                                                    </asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>


                                                        </Columns>
                                                        <%--    <PagerStyle Mode="NumericPages" />--%>
                                                    </asp:GridView>

                                                </td>
                                            </tr>
                                        </table>
                                    </asp:Panel>
                                </td>
                            </tr>

                            <tr>
                                <td style="height: 5px"></td>
                            </tr>
                            <tr>
                                 <td>
                                   <asp:Label ID="Label6" runat ="server" Text="Branch(es)" CssClass ="lbl MarginLeft" ></asp:Label>
                                </td>
                                <td > 
                                    <asp:Label ID="Label7" runat ="server" Text="Mapped Dealer(s)" CssClass ="lbl" ></asp:Label>
                                </td>
                                <td >
                                    <asp:Label ID="Label8" runat ="server" Text="Unmapped Dealer(s)" CssClass ="lbl" ></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Panel ID="Panel1" runat="server" Height="450px" Width="243px">
                                        <asp:ListBox ID="lstBook" runat="server" SelectionMode="Single" AutoPostBack="True" CssClass ="lst MarginLeft"
                                            Width="100%" Height="100%" ToolTip="select Branch to get mapped and unmapped Dealer(s) "></asp:ListBox>
                                    </asp:Panel>
                                </td>
                                <td>
                                    <asp:Panel ID="Panel2" runat="server" ScrollBars="Both" Width="246px" Height="450px" Style="overflow-x: hidden;margin-left: 3px;" 
                                        CssClass="Filter">
                                        <asp:CheckBoxList ID="chkMappedDealersforBook" AutoPostBack ="true" runat="server" Width="100%" RepeatLayout="Flow" Style="border: none !important;"
                                            Height="97%">
                                        </asp:CheckBoxList>
                                    </asp:Panel>
                                </td>
                                <td>
                                    <asp:Panel ID="Panel3" runat="server" ScrollBars="Both" Width="246px" Height="450px" Style="overflow-x: hidden" CssClass="Filter">
                                        <asp:CheckBoxList ID="chkUnMappedDealer" AutoPostBack ="true" runat="server" Height="97%" RepeatLayout="Flow"
                                            Width="100%">
                                        </asp:CheckBoxList>
                                    </asp:Panel>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <asp:Button ID="btnhdnDUnMapped" runat="server" Width="0" Style="width: 0px; height: 0px; font-size: 0; border: none; display: none;" />
            <asp:Button ID="btnhdnUnMapped" runat="server" Width="0" Style="width: 0px; height: 0px; font-size: 0; border: none; display: none;" />
            <asp:Button ID="btnhdnMapped" runat="server" Width="0" Style="width: 0px; height: 0px; font-size: 0; border: none; display: none;" />
            <asp:Button ID="btnhdnDMapped" runat="server" Width="0" Style="width: 0px; height: 0px; font-size: 0; border: none; display: none;" />
            <input type="hidden" id="savePosition" name="savePosition" runat="server" />
            <%--<input type="hidden" id="confirmBox" name="confirmBox" value="" />--%>
            <asp:HiddenField ClientIDMode="Static" ID="confirmBox" Value="" runat="server" />

        </ContentTemplate>

    </asp:UpdatePanel>
</asp:Content>
