<%@ 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">

    
 <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" onclick="selectall(this)" />

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


             


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


                   <asp:BoundField DataField="catname" HeaderText="类别" 
                  SortExpression="catname" />

              <asp:BoundField DataField="keyword" HeaderText="关键字" 
                  SortExpression="keyword" />

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

            
             <asp:BoundField DataField="good" HeaderText="有用"     SortExpression="good"/>


               <asp:BoundField DataField="bad" HeaderText="无用" 
                  SortExpression="bad" ShowHeader="true" />

                  <asp:CommandField ShowDeleteButton="True"   DeleteText="删除" ButtonType="Link" />
                 
                  
              <asp:TemplateField>
                  <ItemTemplate>
                       <a href='Kbase_add.aspx?id=<%#Eval("id") %>'    target="_blank">编辑</a>
                  </ItemTemplate>
            </asp:TemplateField>  
                  
          </Columns>
        
        
      </asp:GridView>


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

   
   &nbsp;&nbsp;&nbsp;&nbsp;
          文档类别移动<asp:DropDownList ID="ddl_cat" runat="server">
    </asp:DropDownList> 
   
    <asp:Button ID="btn_move" OnClientClick="if(isselect()) return true; return false;" 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>
          <UpdateParameters>
              <asp:Parameter Name="title" Type="String" />
              <asp:Parameter Name="keyword" Type="String" />
              <asp:Parameter Name="createdate" Type="DateTime" />
              <asp:Parameter Name="updatedate" Type="DateTime" />
              <asp:Parameter Name="id" Type="Int32" />
          </UpdateParameters>
          
      </asp:SqlDataSource>
       
    
    <input type="hidden" name="hf_ids" id="hf_ids" /> 


</asp:Content>
