<%@ Page Title="主题列表" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Vote_Lists.aspx.cs" Inherits="Vote.Admin.Vote_Lists" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


 <div class="search-wrap">
            <div class="search-content">
              
                    <table class="table">
                        <tr>
                            <th width="120">投票分类:</th>
                            <td width="220px">
                                

<asp:DropDownList ID="DropDownList1" runat="server"  CssClass="form-control"  Width="200px"  AutoPostBack="true"  
        DataSourceID="SqlDataSource2" DataTextField="name" DataValueField="id" AppendDataBoundItems="true">
        <asp:ListItem Text="所有类别" Value=""></asp:ListItem>
    </asp:DropDownList> 

    
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"    
        ConnectionString='<%$ ConnectionStrings:ConnectionString %>' 
        ProviderName="System.Data.SqlClient" 
        SelectCommand="SELECT [id], [name] FROM [vote_category] ORDER BY [orderid] asc "></asp:SqlDataSource>


                            </td>
                            <th width="70">关键字:</th>
                            <td width="220px">
                            
                            <asp:TextBox runat="server"  Width="200px" class="form-control" ID="txt_key" placeholder="关键字" ></asp:TextBox>
                          
                            
                            </td>
                            <td>
 
                                <asp:Button ID="btn_search" class="btn btn-primary btn2" runat="server" Text="查询" />
                            </td>
                             
                        </tr>
                    </table>


                      
                
            </div>
        </div>








<div class="result-wrap">

   <div class="result-title">
                   
                        <a href="Vote_Addnew.aspx"  class="btn btn-primary">新建投票</a>


                        <asp:LinkButton ID="lb_delete" 
                         OnClientClick="if(!isselect()) return false; " 
                        runat="server" onclick="lb_delete_Click"
                             CssClass="btn btn-danger"
                            >批量删除</asp:LinkButton> 
                       
                   
   </div> 








     


   <div id="thetable" class="result-content"> 
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" DataKeyNames="id" 
        DataSourceID="SqlDataSource1" 
         class="table" GridLines="None" 
        onrowdatabound="GridView1_RowDataBound" 
        onrowcommand="GridView1_RowCommand" >
        <Columns>
         <asp:TemplateField> 
        <HeaderTemplate> 
              <asp:CheckBox ID="chk_SelectedHeader" runat="server" AutoPostBack="False" onclick="selectall(this)"  /> 
         </HeaderTemplate> 
                            
         <ItemTemplate  > 
            <input type="checkbox"  class="ck_item"   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:BoundField DataField="id" HeaderText="ID" InsertVisible="False" 
                ReadOnly="True" SortExpression="id" />
                
                
                
           <asp:BoundField DataField="name"  ItemStyle-Width="100px" HeaderText="投票类别" 
                SortExpression="name" >
                        
<ItemStyle Width="100px"></ItemStyle>
            </asp:BoundField>
                        
             <asp:BoundField DataField="votename" HeaderText="投票主题" 
                SortExpression="votename"  ItemStyle-Width="400px" >          
                        
<ItemStyle Width="350px"></ItemStyle>
            </asp:BoundField>
                        
            <asp:BoundField DataField="starttime" HeaderText="开始时间"   DataFormatString="{0:yyyy-MM-dd}" 
                SortExpression="starttime" />
            <asp:BoundField DataField="endtime" HeaderText="结束时间"  DataFormatString="{0:yyyy-MM-dd}" 
                SortExpression="endtime" />
         
            
           <asp:TemplateField>
           <HeaderTemplate>默认投票</HeaderTemplate>
           <ItemTemplate>
                <asp:ImageButton ID="ImageButton1"  ToolTip="单击设置为默认投票" CommandName="setcurrent" runat="server" CommandArgument='<%#Eval("id") %>'  />
           </ItemTemplate>
           </asp:TemplateField>
  
    
           
          
            <asp:TemplateField>
            <HeaderTemplate>操作</HeaderTemplate>
            <ItemTemplate>

            <a href='vote_addnew.aspx?id=<%#Eval("id") %>'>编辑</a>

            <asp:LinkButton runat="server" ID="lb_del"
            OnClientClick="return confirm('您确定要删除? ');"  
             CommandName="Delete">删除</asp:LinkButton>


            &nbsp;|&nbsp;
                
             <a href='voteuserbysid.aspx?sid=<%#Eval("id") %>' <%#Eval("voteby").ToString()=="votebyusername"?"":" style='display:none' " %> target="_blank"  >名单</a>

              <a href='../vote/default.aspx?sid=<%#Eval("id") %>' target="_blank">预览</a>
             </ItemTemplate>
            </asp:TemplateField>

          
            
        </Columns>
         
    
    </asp:GridView>

    </div>


    <asp:SqlDataSource ID="SqlDataSource1"
     ConnectionString='<%$ ConnectionStrings:ConnectionString %>'
     DeleteCommand=" delete from vote_subject where id=@id"
     runat="server" ProviderName="System.Data.SqlClient" 
     SelectCommand="select vote_subject.*,name  from vote_subject inner join vote_category
on vote_subject.catid=vote_category.id   where (@catid='' or catid=@catid) and (@key='' or votename like '%'+@key+'%') order by vote_subject.id desc">

 <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
  </DeleteParameters>
  
  <SelectParameters>
    <asp:ControlParameter ControlID="DropDownList1" ConvertEmptyStringToNull="false" DefaultValue="" Name="catid" />
  <asp:ControlParameter ControlID="txt_key" ConvertEmptyStringToNull="false" DefaultValue="" Name="key" />
  </SelectParameters>
  
</asp:SqlDataSource>
  



















 

     <script>

      


         $('#span_help').on('click', function () {
             layer.msg('投票列表。单击新建投票链接，新建一个投票。名单为可以投票的人员名单', this, {
                 time: 5,
                 style: ['background-color:#0FA6D8; color:#fff', '#0FA6D8'],
                 maxWidth: 450
             });
         });
     
     </script>


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