<%@ Page Title="小类设置" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Category3.aspx.cs" Inherits="Helpdesk.Admin.Category3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


 




<div class="search-wrap">
            <div class="search-content">
              
                    <table class="search-tab">
                        <tr>
                            <th width="150">问题大类:</th>
                            <td>
                              <asp:DropDownList ID="ddl_parentcategory" runat="server"   Width="300"  AutoPostBack="true"
            onselectedindexchanged="ddl_parentcategory_SelectedIndexChanged" >
        </asp:DropDownList>
                            </td>
                        </tr>

                         <tr>
                            <th width="150">问题中类:</th>
                            <td>
                               <asp:DropDownList ID="ddl_midparentcategory" AutoPostBack="true"  
            runat="server"   Width="300" 
            onselectedindexchanged="ddl_midparentcategory_SelectedIndexChanged"  >
        </asp:DropDownList>
                            </td>
                        </tr>


                        
                         <tr>
                                <th width="150"><i class="require-red">*</i>小类名称：</th>
                                <td>
                                   
                                    <asp:TextBox class="common-text required"  ValidationGroup="Add" ID="txt_catname" Text="" Width=300px runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ValidationGroup="Add" ID="RequiredFieldValidator1" runat="server" ErrorMessage="必须填写类别" ControlToValidate="txt_catname" Display="Static"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <th>排序数字：</th>
                                <td>
                                    <asp:TextBox class="common-text" ID="txt_orderid" Text="0" Width=300px runat="server"></asp:TextBox>
                             </td>
                             </tr>

                            

                                   
                            <tr>
                                <th></th>
                                <td>
                                    <asp:Button ID="btn_add" runat="server" Text="添加小类"  ValidationGroup="Add" 
                                        class="btn btn-primary btn6 mr10" onclick="btn_add_Click" />
 
                                
                                </td>
                            </tr> 
                    </table>
                 
            </div>
        </div>
























<div class="result-wrap">
      
                <div class="result-title">
                    <div class="result-list">
                         

                        <asp:LinkButton ID="lb_delete" 
                         OnClientClick="if(!isselect()) return false; " 
                        runat="server" onclick="lb_delete_Click"><i class="icon-font">&#xe037;</i>批量删除</asp:LinkButton> 
                      <asp:LinkButton ID="lb_update_order" runat="server" 
                            onclick="lb_update_order_Click">
                            
                              <i class="icon-font">&#xe065;</i>更新排序

                            </asp:LinkButton>
                                  <a href="#" onclick="PopM();return false" > <i class="icon-font">&#xe063;</i>类别总表</a>  
 
      <a href="#"><span id="span_help"><i class="icon-font">&#xe023;</i>说明</span></a>
                    </div>
                </div>
 




 
  <div id="thetable" class="result-content"> 
                    
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"  AllowPaging="true"  PageSize=20
     class="result-tab" width="100%"
     DataKeyNames="id" DataSourceID="SqlDataSource1">
       
       
        <Columns> 
  <asp:TemplateField> 
        <HeaderTemplate> 
              <asp:CheckBox ID="chk_SelectedHeader" runat="server" AutoPostBack="False" onclick="selectall(this)"  /> 
         </HeaderTemplate> 
                            
         <ItemTemplate  > 
            <input type="checkbox"  class="ck_item"   title=<%# Eval("id") %> value='<%# Eval("id") %>'  /> 
            <asp:HiddenField runat="server" ID="hf_id" Value=<%# Eval("id") %> /> 
          </ItemTemplate>    
          <HeaderStyle  Width=50px  CssClass="tc"/>        
          <ItemStyle  Width=50px  CssClass="tc"/>
          </asp:TemplateField>
                        

         <asp:TemplateField>
         <HeaderTemplate>排序</HeaderTemplate>
          <ItemTemplate>
            <asp:TextBox runat="server" class="common-input sort-input" Text='<%#Bind("orderId") %>' ID="txt_orderid"></asp:TextBox>
          </ItemTemplate>
           <HeaderStyle  Width=80px  /> 
         </asp:TemplateField> 

      

     <asp:BoundField DataField="catname"   ItemStyle-Width="600px" HeaderText="小类名称" SortExpression="catname" />
      
      <asp:CommandField HeaderText="操作" EditText="编辑" DeleteText="<span onclick=&quot;JavaScript:return confirm('确定删除吗？')&quot;>删除</span> "  UpdateText="更新"  CancelText="取消" ShowDeleteButton="True" ShowEditButton="True" />

          
        </Columns>
        
          
    
    </asp:GridView>









                </div>
            
        </div>












        






        <asp:SqlDataSource ID="SqlDataSource1"  
           ConnectionString='<%$ ConnectionStrings:ConnectionString %>'
           Runat="server" 
       DeleteCommand="DELETE FROM [helphesk_categories] WHERE [id] = @id" 
SelectCommand=" select * from helphesk_categories where parentid =@parentid order by orderid asc " 
  UpdateCommand="UPDATE [helphesk_categories] SET [catname] = @catname,   [orderid] = @orderid  WHERE [id] = @id">
       
       <SelectParameters>
        <asp:ControlParameter ControlID="ddl_midparentcategory" Name="parentid" />
       </SelectParameters>
          <DeleteParameters>
              <asp:Parameter Name="id" Type="Int32" />
          </DeleteParameters>
          <UpdateParameters>
              <asp:Parameter Name="catname" Type="String" />
              <asp:Parameter Name="orderid" Type="Int32" />
            </UpdateParameters>


    </asp:SqlDataSource>
 





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







     <script>


         $('#span_help').on('click', function () {
             layer.msg('在问题小类里，选择大类，中类后，下表显示该类别下的子类', this, { time: 5,
                 style: ['background-color:#0FA6D8; color:#fff', '#0FA6D8'],
                 maxWidth: 450
             });
         });


       
     </script>



      

      
  <script>





      function SetOpValue(o2) {
          try {
              result = o2.split(";");
              for (i = 0; i < result.length; i++) {
                  if (result[i] != "") {
                      var r = result[i].split("$");
                      var _username = r[1];
                      $("#txt_usernames").val($("#txt_usernames").val() + ";" + _username);
                  }
              }
          }
          catch (e) {

          }

      }



      function PopM() {
          layer.open({
              type: 2,
              maxmin: true,
              shadeClose: true,
              title: '分类一览表',
              shade: [0.1, '#fff'],
              offset: ['20px', ''],
              area: ['1000px', ($(window).height() - 50) + 'px'],
              content: "CategoryTable.aspx"  
          });
      }
  </script>







</asp:Content>
