<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Pop_Projector.aspx.cs" Inherits="Book.Book.Pop_Projector" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" />
 <script src="../javascript/jquery-1.9.1.min.js"></script>
    <script src="../bootstrap/js/bootstrap.min.js"></script>
    
    <script src="../Javascript/layer/layer.min.js"></script>
    
    <link href="../style/btn.css" rel="stylesheet" />
    <script src="../Javascript/common.js"></script>
    <link href="../style/patch.css" rel="stylesheet" />

      <style>
            .btn {
         border-radius:0px;
        }
        #gv_pc tr td{ cursor:pointer}
    </style>

</head>
<body style="font-size:13px; margin:8px;">
    <form id="form1" runat="server">


        <div class="well" style="height:70px;"> 
       <div class="pull-left "  >
      <asp:DropDownList runat="server" ID="ddl_area" Width="300px" CssClass="form-control" AutoPostBack="True" 
            onselectedindexchanged="ddl_area_SelectedIndexChanged" ClientIDMode="Static"></asp:DropDownList> 
           </div>


             <div class="pull-right input-group form-group form-inline"  >  
         
       <button class="btn btn-primary btn-flat" id="btnSelect"
              onclick="submitAndClose(); "
              > 确定</button>
     &nbsp;&nbsp;&nbsp;&nbsp;
  <button class="btn btn-danger btn-flat" onclick=" parent.layer.close(parent.layer.getFrameIndex(window.name));"> 关闭</button>
      </div>




            </div>


  <asp:GridView ID="gv_pc"  
      AutoGenerateColumns="false"   
   DataKeyNames="id"  
      ClientIDMode="Static" 
       BorderWidth="0px"
     CssClass="table table-hover dataTable"
   AllowPaging="false"  
   runat="server"  
     GridLines="None"
      >
    <Columns>
   
   <asp:TemplateField>
    <ItemTemplate>
    <input type="checkbox" 
     title='<%#Eval("catname") %>' 
     <%#Book.BLL.CategoryHelper.IsCatEnabled(Eval("allowroles")) %> class="roomgroup"  value='<%#Eval("id")%>$<%#Eval("catname") %>'   id="room<%#Eval("id")%>"/>
   
    </ItemTemplate>
   <ItemStyle Width=40px />
   </asp:TemplateField>

   <asp:TemplateField>
   <ItemStyle Width=450px  HorizontalAlign="Left" />
   <HeaderStyle HorizontalAlign="Left" />
   <HeaderTemplate>笔记本名称</HeaderTemplate>
   <ItemTemplate> 
  <span style="color:#428bca">
   <%#Eval("catname") %>
   </span>
   </ItemTemplate>
   
   </asp:TemplateField>
     
    

         

  
<asp:TemplateField>
<HeaderTemplate>
 状态
</HeaderTemplate>
<ItemTemplate>
 
    <%#isFree(Eval("id")) %>

</ItemTemplate>
 

</asp:TemplateField>



 </Columns>
    
   
    </asp:GridView>
  


        <script>




            $("#gv_pc").on("click", "tr", function () {

                $(".roomgroup").prop("checked", false);

                $(this).parent().find("tr").each(
                    function () {
                        $(this).removeClass("selected");
                    });


                var input = $(this).find("input");

                if ($(input).prop("disabled")) {
                }
                else {


                    if ($(input).prop("checked")) {
                        $(input).prop("checked", false);
                        $(this).removeClass("selected");
                    }

                    else {
                        $(input).prop("checked", true);
                        $(this).addClass("selected");
                    }
                }



            });












            function submitAndClose() {
                var checked = 0;
                var result = '';

                var _c = 0;
                $(".roomgroup").each(
                 function () {
                     if ($(this).is(':checked')) {
                         checked++;  
                         result = $(this).val()+"$"+$("#ddl_area").val(); 
                     }
                 }

                );



               

                parent.setPopProjector(result);
                parent.layer.close(parent.layer.getFrameIndex(window.name));

     }

        </script>
     
    </form>
</body>
</html>
