<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Simple.Master" AutoEventWireup="true" CodeBehind="Kb_Lists.aspx.cs" Inherits="Kbase.admin.Kb_Lists" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <asp:Panel runat="server" ID="pnl_add">


       <div style="text-align:right; margin:10px;">
                  <a href="Kb_New.aspx?catid=<%=catid %>">新文章</a>


               <ul class="breadcrumb">
                   <asp:Literal runat="server" ID="lbl_nav"></asp:Literal>
             </ul>
             
  </div>
    </asp:Panel>

    <asp:ListView runat="server" ID="list1" DataKeyNames="id" DataSourceID="sds">
         
        
       
        <LayoutTemplate>
          
               <table    class="table table-bordered">
                            <tr  >
                                <th   width="100">ID</th>
                                <th  >标题</th> 
                                <th  width="120">操作</th>
                                     <th  width="80">排序ID</th>
                                 <th  width="80">点击</th>
                            </tr>
                            <tr id="itemPlaceholder" runat="server">
                            </tr>
                        </table>
                   
        </LayoutTemplate>
       
 

         <ItemTemplate>
            <tr style="">
                <td>
                 <%# Eval("id") %> 
                </td>
                <td>
                   <%# Eval("title") %>
                </td>
                <td>
                   <a href="Kb_New.aspx?id=<%# Eval("id") %>" class="btn btn-primary btn-sm">编辑</a>    
                    
                    
                    <asp:Button runat="server" Text="删除" 
                         OnClientClick="return confirm('确定删除吗');"
                        CssClass="btn btn-sm btn-danger" ID="btn_del" CommandName="delete" />
                </td>

                    <td>
                        <input type="text" value="<%# Eval("orderid") %>"  id="txt<%#Eval("id")%>"
                            onchange="save('ordernum',<%#Eval("id")%>,this);"  
                             title="请输入分类ID，数字大在前面，支持小数"
                            />
                    
                </td>

                <td>
                    <%# Eval("click") %>
                </td>
            </tr>
        </ItemTemplate>
       

    </asp:ListView>





    
    <script>

        function save(types,id,text)
        {
            var orderid = $(text).val();
            orderid = parseFloat(orderid);
            orderid = orderid.toFixed(8);
            $("#txt" + id).val(orderid);

            $.get("ajax/Orders.aspx", { t: "kb", id: id, text: orderid, t: Math.random() });
            layer.msg("更新成功");
            
        
        }


    </script>




    
<div style="text-align:center">
 <asp:DataPager ID="DataPager1"   class="btn-group btn-group-sm" EnableViewState="false"
      QueryStringField="Page" PagedControlID="list1" runat="server" PageSize=10>
 <Fields>
           
     
            <asp:NextPreviousPagerField 
                PreviousPageText="<" 
                FirstPageText="|<" 
                ShowPreviousPageButton="true"
                ShowFirstPageButton="true" 
                ShowNextPageButton="false" 
                ShowLastPageButton="false"
                ButtonCssClass="btn btn-default" 
                RenderNonBreakingSpacesBetweenControls="false" 
                RenderDisabledButtonsAsLabels="false" />

            <asp:NumericPagerField 
                ButtonType="Link" 
                CurrentPageLabelCssClass="btn btn-primary disabled"  
                RenderNonBreakingSpacesBetweenControls="false"
                NumericButtonCssClass="btn btn-default" 
                ButtonCount="10" 
                NextPageText="..." 
                NextPreviousButtonCssClass="btn btn-default" />
            
           <asp:NextPreviousPagerField 
               NextPageText=">" 
               LastPageText=">|" 
               ShowNextPageButton="true"
               ShowLastPageButton="true" 
               ShowPreviousPageButton="false" 
               ShowFirstPageButton="false"
               ButtonCssClass="btn btn-default" 
               RenderNonBreakingSpacesBetweenControls="false" 
               RenderDisabledButtonsAsLabels="false"/>
      

  </Fields> 
</asp:DataPager>
</div>


    <asp:SqlDataSource runat="server" ID="sds"
         ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
         DeleteCommand="delete from  kb_news where id=@id"
         SelectCommand="SELECT [id], [title], [catid], [orderid],click FROM [kb_news] where (@catid='' or catid=@catid ) order by orderid desc   "
        
         
        
        >

        <SelectParameters>
            <asp:QueryStringParameter Name="catid" QueryStringField="id" DefaultValue="" ConvertEmptyStringToNull="false" />
        </SelectParameters>

    </asp:SqlDataSource>




</asp:Content>
