<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Category1.aspx.cs" Inherits="helpdesk.Admin.Category1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


    
    <style>
        .icon {
         width:30px; height:30px;
        }
    </style>


    <asp:UpdatePanel runat="server" ID="pnl1" UpdateMode="Conditional">
        <ContentTemplate>

      
            <div class="layui-card">
                 <div class="layui-card-body">


                 <div class="layui-row layui-col-space10 layui-form-item">
                       <div >
                           <label class="layui-form-label req">一级分类</label>
                           <div class="layui-input-block">
                               <asp:TextBox runat="server" ID="txt_catname" 
                                    autocomplete="off" 
                                    class="layui-input"

                                   ></asp:TextBox>

                               <asp:RequiredFieldValidator ControlToValidate="txt_catname"
                                    ErrorMessage="必填填写一级分类" ValidationGroup="add" Display="Dynamic"
                                    runat="server" ID="rf1"></asp:RequiredFieldValidator>
                               
                           </div>
                       </div>

                        
                   </div>


                    
                    
                     



                     
                 <div class="layui-row layui-col-space10 layui-form-item">
                       <div >
                           <label class="layui-form-label req">顺序号</label>
                           <div class="layui-input-block">
                              
                                   <asp:TextBox    class="layui-input"  ID="txt_orderid" Text="0" Width=300px runat="server"></asp:TextBox>

                               
                           </div>
                       </div>

                        
                   </div>



                   <div class="layui-form-item">
                       <div class="layui-input-block">

                         

                           <asp:Button runat="server" 
                                ID="btn_add"
                                Text="添加" 
                                ValidationGroup="add"
                               OnClick="btn_add_Click"
                               class="layui-btn"
                                />
                          
                      
                       </div>
                   </div>








                </div>

  </div>
        



        </ContentTemplate>
    </asp:UpdatePanel>










    <!-- list -->

     <asp:UpdatePanel runat="server" ID="pnl2">
        <ContentTemplate>
   
            <div class="layui-card">
                 <div class="layui-card-body">
     
           <div style="padding-bottom: 10px;">
          <asp:Button runat="server" ID="btn_del" 
               OnClientClick=" if(!isselect()) { return false;} "
               Text="批量删除" 
              class="layui-btn layui-btn-danger"
               OnClick="btn_del_Click" />

</div>


 

         
                       <asp:ListView runat="server" 
                           ID="lv_lists" EnableViewState="false"  DataSourceID="sds" 
                           DataKeyNames="id" >

                           <LayoutTemplate>
                            
                                         <table  class="layui-table"  >
                                              <thead>
                                              <tr>
                                                
                                                 <th width="100px" >   <input type="checkbox"   id="chk_all" lay-skin="primary"  lay-filter="chk_all" > ID</th>
                                                 <th width="300px">一级分类</th>
                                                
                                                 <th >操作</th>

                                                       <th >顺序</th>
                                             </tr>
                                                  </thead>
                                            
                                             
                                              <tbody>  
                                                 <tr id="itemPlaceholder" runat="server">
                                                 </tr>
                                            </tbody>
                                         </table>
                                     
                                         
                                   
                         </LayoutTemplate>
                       


                          <ItemTemplate>
                             <tr  > 
                                 
                                 <td>
                                   <input type="checkbox" class="chk_item" value="<%# Eval("id") %>"  name="chk_item" lay-skin="primary" >   <%# Eval("id") %>
                                 </td>

                                 <td>
                                     <asp:Label ID="catnameLabel" runat="server" Text='<%# Eval("catname") %>' />
                                 </td>
                                 
                                <td>
                                     <asp:Label ID="Label1" runat="server" Text='<%# Eval("orderid") %>' />
                                 </td>
                                 

                                 <td>

                                   <asp:LinkButton runat="server" ID="EditButton"  CommandName="Edit"
                                        class="layui-btn layui-btn-xs"
                                       >编辑</asp:LinkButton>


                                         <asp:LinkButton runat="server" ID="DeleteButton" 
                                             
                                              OnClientClick="return confirm('确定删除吗？')"
                                              CommandName="Delete"
                                        class="layui-btn layui-btn-danger layui-btn-xs"
                                       >删除</asp:LinkButton>


                                      
                                     
                                 </td>
                             </tr>
                         </ItemTemplate>
                        
                         
                         <EditItemTemplate>
                             <tr style="">
                                
                                 <td>
                                     <asp:Label ID="idLabel1" runat="server"  Text='<%# Eval("id") %>' />
                                 </td>

                                 <td>
                                     <asp:TextBox ID="catnameTextBox" runat="server"  CssClass="layui-input  "  Text='<%# Bind("catname") %>' />
                                 </td>

                                    <td>
                                     <asp:TextBox ID="TextBox1" runat="server"  CssClass="layui-input  "  Text='<%# Bind("orderid") %>' />
                                 </td>

                                 
                               
                                 <td>
                                     <asp:LinkButton ID="UpdateButton" 
                                          class="layui-btn layui-btn-xs layui-btn-normal"

                                         runat="server" CommandName="Update" Text="更新" />
 

                                     <asp:LinkButton                                          
                                           class="layui-btn layui-btn-xs layui-btn-warm"
                                         ID="CancelButton" runat="server" CommandName="Cancel" Text="取消" />
                                 </td>
                             </tr>
                         </EditItemTemplate>
                         
                         


                     </asp:ListView>




                   
















       <asp:SqlDataSource ID="sds"  
           ConnectionString='<%$ ConnectionStrings:ConnectionString %>'
           Runat="server" 
           DeleteCommand="DELETE FROM [helphesk_categories] WHERE [id] = @id"  
           SelectCommand="SELECT id,catname, orderid FROM [helphesk_categories] where  parentid=0 ORDER BY orderid asc  " 
           UpdateCommand="UPDATE [helphesk_categories] SET [catname] = @catname,  orderid=@orderid  WHERE [id] = @id"  >
                   
    </asp:SqlDataSource>

 
     
</div>
                </div>
      
            
        </ContentTemplate>
    </asp:UpdatePanel>


    <!-- /list -->









      

     

  
    <script src="../layuiadmin/layui/layui.all.js"></script>
   

    
    <script>

        chkAll();

    </script>

 
    <input type="hidden" name="hf_ids" id="hf_ids" />



</asp:Content>
