<%@ Page Title="" Language="C#" MasterPageFile="car.Master" AutoEventWireup="true" CodeBehind="car_mgr.aspx.cs" Inherits="Car.admin.car_mgr" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


    <div style="padding:10px; width:95%; text-align:right">
    <a href="###" onclick="Pop('car_addedit.aspx',920,600,'添加车辆')" class="btn btn-primary btn-flat">添加车辆</a>
        </div>


    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
  <div class="content">

     


      <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
          <ContentTemplate>


              <asp:GridView ID="GridView1" AllowPaging="true"
                   PageSize="20" runat="server"
                   
                   AllowSorting="false" 
                   GridLines="None" CssClass="table table-hover " 
                   AutoGenerateColumns="False" 
                  DataKeyNames="id" 
                  DataSourceID="SqlDataSource1">
                  <Columns>

                    
  <asp:BoundField DataField="id" HeaderText="id"  HeaderStyle-Width="50px" InsertVisible="False" ReadOnly="True" SortExpression="id" />
  <asp:BoundField DataField="carname"   HeaderStyle-Width="100px" HeaderText="车辆名称" SortExpression="carname" />
  <asp:BoundField DataField="carnum"    HeaderStyle-Width="100px"  HeaderText="车牌号" SortExpression="carnum" />
  <asp:BoundField DataField="num"     HeaderStyle-Width="50px"  HeaderText="人数" SortExpression="num" />
  <asp:BoundField DataField="status"    HeaderStyle-Width="60px"   HeaderText="状态" SortExpression="status" />
  <asp:TemplateField >
<HeaderTemplate>
     <asp:LinkButton runat="server" ID="lb_dusername"  CommandName="Sort" CommandArgument="dusername" 
           Visible="false" ></asp:LinkButton>
    司机
</HeaderTemplate>
<ItemTemplate>
 <%# Eval("dusername") %> 
     
</ItemTemplate> 
       
</asp:TemplateField>
                       
                        
 <asp:BoundField DataField="njdate"    HeaderStyle-Width="100px" DataFormatString="{0:yyyy-MM-dd}" HeaderText="年检日期" SortExpression="njdate" />
 <asp:BoundField DataField="km"     HeaderStyle-Width="80px" HeaderText="里程" SortExpression="km" />
 <asp:BoundField DataField="color"   HeaderStyle-Width="50px" HeaderText="颜色" SortExpression="color" />
 <asp:BoundField DataField="note" HeaderText="备注" />

 <asp:TemplateField>
                          <HeaderTemplate>编辑</HeaderTemplate>
                          <HeaderStyle Width="60px" />
                          <ItemTemplate>

                              <a href="###" onclick=Pop("car_addedit.aspx?id=<%#Eval("id")%>",920,600,'编辑车辆')   
                                    >编辑</a> 
                          </ItemTemplate>

                      </asp:TemplateField>

        <asp:CommandField   DeleteText="<span onclick=&quot;JavaScript:return confirm('确定删除吗？')&quot;>删除</span> "
             ItemStyle-Width="60px" HeaderText="删除"
             ShowDeleteButton="true" ControlStyle-Width="60px"  />

                   

 
                             


                  </Columns>

                  <PagerStyle CssClass="pagination-ys" />
              </asp:GridView>


      
              <asp:SqlDataSource 
                  
                   ConnectionString="<%$ ConnectionStrings:Connectionstring %>"
                  ID="SqlDataSource1" runat="server" 
                  DeleteCommand="delete from car_lists where id=@id"
               　SelectCommand=" select * from   [car_lists] ORDER BY [id] DESC " 
               >
                  <DeleteParameters>
                      <asp:Parameter Name="id" Type="Int32" />
                  </DeleteParameters>
                  
                 
              </asp:SqlDataSource>
          </ContentTemplate>


      


      </asp:UpdatePanel>
      
      
      
      
      
      <script>

          function viewCar(_id)
          { 
          layer.open({
              type: 2,
              title: "查看资料",
              area: ['950px', '650px'],
              fix: false, //不固定
              maxmin: true,
              content: "car_detail.aspx?id=" + _id,

              cancel: function (index) {
                

              }
          });
          }
      </script>
      
      
      
       </div>
</asp:Content>
