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

     
 
  


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

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

             


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


                   <asp:BoundField DataField="catname" HeaderText="分类名" 
                  SortExpression="catname"  HeaderStyle-Width="100px"/>

            

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

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




   <asp:SqlDataSource ConnectionString="<%$ ConnectionStrings:connectionstring %>" 
        ID="SqlDataSource1" runat="server" 
        DeleteCommand="DELETE FROM [helpdesk_news] WHERE [id] = @id" 
        InsertCommand="INSERT INTO [helpdesk_news] ([catid], [title], [createdate]) VALUES (@catid, @title, @createdate)" 
        ProviderName="System.Data.SqlClient" 
        SelectCommand="SELECT  helpdesk_news.id,addby, [catid],catname, [title], [createdate] FROM [helpdesk_news] left join helpdesk_newscat on helpdesk_news.catid=helpdesk_newscat.id  where ( (@catid=0) or(catid=@catid)) ORDER BY [id] DESC " 
        UpdateCommand="UPDATE [helpdesk_news] SET [catid] = @catid, [title] = @title, [createdate] = @createdate WHERE [id] = @id">
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
       
       <SelectParameters>
       <asp:QueryStringParameter Name="catid" Type="Int32" DefaultValue="0" QueryStringField="catid" />
       </SelectParameters>
    </asp:SqlDataSource>
   
 
 

    
    <input type="hidden" name="hf_ids" id="hf_ids" /> 


</asp:Content>
