<%@ Page Title="" Language="C#" MasterPageFile="~/helpdesk/KBase.master" AutoEventWireup="true" CodeBehind="Kbase_mgr.aspx.cs" Inherits="helpdesk.helpdesk.Kbase_mgr" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">

    <link href="../style/gv_paging.css" rel="stylesheet" />
 <div  class="well">
<b>搜索</b>
     标题关键字搜索 
    <asp:TextBox ID="txt_key" CssClass="form-control inline" Width="200" runat="server"></asp:TextBox>
  

    
 分类查看 <asp:DropDownList id="parentname" CssClass="form-control inline" Width="200"  runat="server"   AutoPostBack="true"    >
  <asp:ListItem Text="所有类别" Value=""></asp:ListItem>
    </asp:DropDownList>
   <asp:Button ID="btn_search" runat="server" Text="搜索" CssClass="btn btn-primary" />
     </div>



<div id="div1">
      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
          DataKeyNames="id" DataSourceID="SqlDataSource1"   AllowSorting="true"
           GridLines="None" CssClass="table table-hover"   AllowPaging="True" PageSize=20>
         
          <Columns>
             
              
              <asp:TemplateField ControlStyle-Width="75px"  >  
      
                <HeaderTemplate > 
                 <input type="checkbox" id="cb_selectall" />

              </HeaderTemplate> 
                              
               <ItemTemplate > 
                      <input type="checkbox" class="chk_item" value='<%# Eval("id") %>'/> <%# Eval("id") %>
                    </ItemTemplate>
                
               </asp:TemplateField>


             


             <asp:TemplateField>
             <HeaderTemplate>标题</HeaderTemplate>
             <ItemTemplate>
               <a href="Kbase_add.aspx?id=<%#Eval("id") %>&kid=<%#Eval("kcatid") %>"   ><%#Eval("title")%></a>
             </ItemTemplate>
             </asp:TemplateField>
                  


                   <asp:BoundField DataField="catname" HeaderText="类别" 
                  SortExpression="catname" HeaderStyle-Width="180px"/>

              <asp:BoundField DataField="keyword" HeaderText="关键字" 
                  SortExpression="keyword"  HeaderStyle-Width="180px"/>

              <asp:BoundField DataField="createdate" HeaderText="建立时间"  HeaderStyle-Width="160px"
                  SortExpression="createdate" DataFormatString="{0:yyyy-M-d}" />
         

            
             <asp:BoundField DataField="good" HeaderText="有用"    HeaderStyle-Width="60px"  SortExpression="good"/>


               <asp:BoundField DataField="bad" HeaderText="无用"  HeaderStyle-Width="60px"    SortExpression="bad"  />

                  <asp:CommandField ShowDeleteButton="True" HeaderStyle-Width="80px"
                        DeleteText="<span onclick=&quot;JavaScript:return confirm('确定删除吗？')&quot;>删除</span> "  ButtonType="Link" />
                 
                  
              <asp:TemplateField>
                  <HeaderStyle Width="180" />
                  <ItemTemplate>
                       <a href='Kbase_add.aspx?id=<%#Eval("id") %>'    target="_blank">编辑</a>
                      &nbsp;&nbsp;&nbsp;&nbsp;
                          <a href="Kbase_view.aspx?id=<%#Eval("id") %>&kid=<%#Eval("kcatid") %>"   >查看</a>
                  </ItemTemplate>
            </asp:TemplateField>  
                  
          </Columns>
        <PagerStyle CssClass="pagination-ys" />
        
      </asp:GridView>


    <asp:Button ID="btn_batdel" runat="server" Text="批量删除" 
         CssClass="btn btn-flat btn-sm btn-danger"
          onclick="btn_batdel_Click" 
        OnClientClick="if(isselect()) return true; return false;" 
        />

   
   &nbsp;&nbsp;|&nbsp;&nbsp;
          文档类别移动<asp:DropDownList ID="ddl_cat"  
               style="display:inline-block; width:200px"
               CssClass="form-control" runat="server">
    </asp:DropDownList> 
   
    <asp:Button ID="btn_move" 
        OnClientClick="if(isselect()) return true; return false;" 
         CssClass="btn btn-success btn-sm btn-flat"
        runat="server" Text="确定移动" 
        onclick="btn_move_Click" />

</div>


 


      <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
          ConnectionString="<%$ ConnectionStrings:connectionstring %>" 
          DeleteCommand="DELETE FROM [helpdesk_kbase] WHERE [id] = @id" 

          SelectCommand="SELECT kcatid, good,bad, helpdesk_kbase.id,catname, [title], [keyword], [createdate],addby FROM [helpdesk_kbase]
left join helpdesk_kbcategory on helpdesk_kbase.kcatid=helpdesk_kbcategory.id 
           where ((@key='') or (title+keyword like '%'+@key+'%')) 
          and (@catid='' or helpdesk_kbase.kcatid=@catid)  
           ORDER BY helpdesk_kbase.id DESC" 
           >
           <SelectParameters>
              <asp:ControlParameter Name="key"  DefaultValue="" ConvertEmptyStringToNull="false" ControlID="txt_key" />
              <asp:ControlParameter Name="catid"  DefaultValue="" ConvertEmptyStringToNull="false" ControlID="parentname" />
           </SelectParameters>

          <DeleteParameters>
              <asp:Parameter Name="id" Type="Int32" />
          </DeleteParameters>
       

          
      </asp:SqlDataSource>
       
    
    <input type="hidden" name="hf_ids" id="hf_ids" /> 


</asp:Content>
