Default.aspx
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>供求信息网审核发布信息</title>
</head>
<body class="Font">
<form id="form1" runat="server">
<div style="text-align: left" align="left"><asp:Panel ID="Panel2" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
OnRowDataBound="GridView1_RowDataBound"
OnSelectedIndexChanging="GridView1_SelectedIndexChanging" Font-Size="9pt"
AllowPaging="True" EmptyDataText="没有相关数据可以显示!"
OnPageIndexChanging="GridView1_PageIndexChanging" CellPadding="4"
ForeColor="#333333" GridLines="None" DataKeyNames="id">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="cbSingleOrMore" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="id" HeaderText="信息ID" />
<asp:BoundField DataField="name" HeaderText="信息主题" />
<asp:BoundField DataField="type" HeaderText="信息分类" />
<asp:BoundField DataField="content" HeaderText="发布内容" />
<asp:BoundField DataField="userName" HeaderText="发布人" />
<asp:BoundField DataField="lineMan" HeaderText="联系人" />
<asp:BoundField DataField="issueDate" HeaderText="发布时间"
DataFormatString="{0:d}" />
</Columns>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Right" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</asp:Panel>
<asp:CheckBox ID="cbAll" runat="server" AutoPostBack="True"
Font-Size="9pt" OnCheckedChanged="cbAll_CheckedChanged"
Text="全选/反选" />
<asp:Button ID="btnUpdateTime" runat="server" onclick="btnUpdateTime_Click"
Text="更新发布时间" />
</div>
</form>
</body>
</html>
</div>
Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Data.SqlClient;
public partial class Index : System.Web.UI.Page
{
SqlConnection sqlcon;
string strCon = ConfigurationManager.AppSettings["conStr"];
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.GV_DataBind();
}
}
public void GV_DataBind()
{
string sqlstr = "select * from tb_inf";
sqlcon = new SqlConnection(strCon);
SqlDataAdapter da = new SqlDataAdapter(sqlstr, sqlcon);
DataSet ds = new DataSet();
&nbs