📄 listbooksbycategory.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 MyBookShop.BLL;
using MyBookShop.Models;
using System.Text;
public partial class Admin_ListBooksByCategory : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSure_Click(object sender, EventArgs e)
{
string sb =String.Empty;
for (int i = 0; i < this.grv_Books.Rows.Count; i++)
{
CheckBox cb = (grv_Books.Rows[i].FindControl("chb_Select")) as CheckBox;
if (cb.Checked == true)
{
sb += (grv_Books.Rows[i].FindControl("lbl_Id") as Label).Text+",";
}
}
string catagory = this.ddl_Catagory.SelectedItem.Value;
ChangeCatagory(sb, catagory);
}
private void ChangeCatagory(String sb, string catagory)
{
if (sb.Length > 0)
{
sb = sb.Substring(0, sb.Length - 1);
}
BookManager.ModifyBook(sb, catagory);
Response.Redirect("ListBooksByCategory.aspx");
}
public string GetCategary(object Categary)
{
return ((Category)Categary).Name;
}
protected void grv_Books_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -