⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classmanage.aspx.cs

📁 一个简单的新闻后台管理系统
💻 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.SqlClient;

public partial class NewsClassManage_ClassManage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void GrdClassManage_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        // 为每一个数据行添加两个属性,实现当鼠标经过时高亮的效果

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //鼠标移到该行时所在行变颜色,移出时恢复原来颜色

            e.Row.Attributes.Add("onMouseOver", "this.style.cursor='hand';this.originalcolor=this.style.backgroundColor;this.style.backgroundColor='Silver';");
            e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=this.originalcolor;");
        }
        if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowType != DataControlRowType.Header
            && e.Row.RowType != DataControlRowType.Footer && e.Row.RowType != DataControlRowType.EmptyDataRow
            && e.Row.RowState != DataControlRowState.Edit && e.Row.RowState != (DataControlRowState.Alternate | DataControlRowState.Edit))
        {
            //onclick删除按钮事件时,弹出确认对话框,提示您是否要删除该记录

            ((LinkButton)e.Row.Cells[6].Controls[0]).Attributes.Add("onclick", "return confirm('你确认要删除分类名称为[" + e.Row.Cells[1].Text + "] 的这条记录吗?');");

        }
        //try
        //{
        //    int a = int.Parse(e.Row.Cells[4].Text);
        //}
        //catch (FormatException)
        //{
        //    Response.Write("<script>window.alert('请输入整数!')</script>");
        //}
    }
   
   
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -