富贵资源网 Design By www.hznty.com
book_admin.aspx
复制代码 代码如下:
<asp:GridView ID="grwBook" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="false" AllowPaging="true" DataKeyNames="ID" OnPageIndexChanging="grwBook_PageIndexChanging" PageSize="12">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="ID" HeaderText = "ID" />
<asp:BoundField DataField="UserName" HeaderText="姓名">
<ItemStyle Width="60px" />
</asp:BoundField>
<asp:BoundField DataField="Comments" HeaderText="评论">
<ItemStyle width="500px" />
</asp:BoundField>
<asp:BoundField DataField="Postdate" HeaderText="日期" />
<asp:HyperLinkField DataNavigateUrlFields="newsid" DataNavigateUrlFormatString="../news_zi.asp?id={0}" HeaderText="文章" DataTextField="newsid" target="_blank" />
<asp:TemplateField HeaderText="操作" >
<ItemTemplate>
<asp:CheckBox runat="Server" ID="cbxId" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerSettings Mode="NextPreviousFirstLast" FirstPageText="第一页" LastPageText="末页" NextPageText="下一页" PreviousPageText="上一页" />
</asp:GridView>
book_admin.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.Data.OleDb;
public partial class admin_book_admin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//判断管理员是否已经登陆
admin.checkadmin();
btnDel.Attributes.Add("onclick", "return confirm('确定删除吗?')");
if (!Page.IsPostBack)
{
datainit();
}
}
protected void grwBook_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.grwBook.PageIndex = e.NewPageIndex;
Session["curretnPage"] = e.NewPageIndex;
datainit();
}
//数据绑定
private void datainit()
{
DataSet ds = db.dataSet("select ID,UserName,Comments,Postdate,newsid from Feedback order by Postdate desc,newsid desc");
if (ViewState["currentPage"] != null)
{
this.grwBook.PageIndex = Convert.ToInt32(Session["currentPage"]);
}
this.grwBook.DataSource = ds;
this.grwBook.DataBind();
}
//执行删除操作
protected void btnDel_Click(object sender, EventArgs e)
{
string sqlText = "(";
for (int i = 0; i < grwBook.Rows.Count; i++)
{
//搜索第n行3列
CheckBox cbx = (CheckBox)grwBook.Rows[i].FindControl("cbxId");
if (cbx.Checked == true)
{
sqlText = sqlText + Convert.ToInt32(grwBook.DataKeys[i].Value) + ",";
}
}
//判断是否有选中
if (sqlText != "(")
{
//去掉最后的逗号,并且加上右括号
sqlText = sqlText.Substring(0, sqlText.Length - 1) + ")";
sqlText = "delete from Feedback where ID in" + sqlText;
try
{
//执行删除语句
db.excuteSql(sqlText);
//重新绑定数据
common.salert("删除成功");
datainit();
//Response.Redirect("book_admin.aspx");
}
catch (Exception ex)
{
//若有错误发生,输出错误信息
common.salert(ex.Message);
}
finally
{
}
}
else
{
common.salert("您还没有选中有删除的项");
}
}
}
复制代码 代码如下:
<asp:GridView ID="grwBook" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="false" AllowPaging="true" DataKeyNames="ID" OnPageIndexChanging="grwBook_PageIndexChanging" PageSize="12">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="ID" HeaderText = "ID" />
<asp:BoundField DataField="UserName" HeaderText="姓名">
<ItemStyle Width="60px" />
</asp:BoundField>
<asp:BoundField DataField="Comments" HeaderText="评论">
<ItemStyle width="500px" />
</asp:BoundField>
<asp:BoundField DataField="Postdate" HeaderText="日期" />
<asp:HyperLinkField DataNavigateUrlFields="newsid" DataNavigateUrlFormatString="../news_zi.asp?id={0}" HeaderText="文章" DataTextField="newsid" target="_blank" />
<asp:TemplateField HeaderText="操作" >
<ItemTemplate>
<asp:CheckBox runat="Server" ID="cbxId" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerSettings Mode="NextPreviousFirstLast" FirstPageText="第一页" LastPageText="末页" NextPageText="下一页" PreviousPageText="上一页" />
</asp:GridView>
book_admin.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.Data.OleDb;
public partial class admin_book_admin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//判断管理员是否已经登陆
admin.checkadmin();
btnDel.Attributes.Add("onclick", "return confirm('确定删除吗?')");
if (!Page.IsPostBack)
{
datainit();
}
}
protected void grwBook_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.grwBook.PageIndex = e.NewPageIndex;
Session["curretnPage"] = e.NewPageIndex;
datainit();
}
//数据绑定
private void datainit()
{
DataSet ds = db.dataSet("select ID,UserName,Comments,Postdate,newsid from Feedback order by Postdate desc,newsid desc");
if (ViewState["currentPage"] != null)
{
this.grwBook.PageIndex = Convert.ToInt32(Session["currentPage"]);
}
this.grwBook.DataSource = ds;
this.grwBook.DataBind();
}
//执行删除操作
protected void btnDel_Click(object sender, EventArgs e)
{
string sqlText = "(";
for (int i = 0; i < grwBook.Rows.Count; i++)
{
//搜索第n行3列
CheckBox cbx = (CheckBox)grwBook.Rows[i].FindControl("cbxId");
if (cbx.Checked == true)
{
sqlText = sqlText + Convert.ToInt32(grwBook.DataKeys[i].Value) + ",";
}
}
//判断是否有选中
if (sqlText != "(")
{
//去掉最后的逗号,并且加上右括号
sqlText = sqlText.Substring(0, sqlText.Length - 1) + ")";
sqlText = "delete from Feedback where ID in" + sqlText;
try
{
//执行删除语句
db.excuteSql(sqlText);
//重新绑定数据
common.salert("删除成功");
datainit();
//Response.Redirect("book_admin.aspx");
}
catch (Exception ex)
{
//若有错误发生,输出错误信息
common.salert(ex.Message);
}
finally
{
}
}
else
{
common.salert("您还没有选中有删除的项");
}
}
}
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?