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

📄 linkedit.aspx.cs

📁 xiexie ,以后会更新的xiexie ,以后会更新的xiexie ,以后会更新的xiexie ,以后会更新的xiexie ,以后会更新的
💻 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;

public partial class manage_link_linkEdit : System.Web.UI.Page
{
    BaseClass bc = new BaseClass();
    protected void Page_Load(object sender, EventArgs e)
    {
        string strSql = "select * from tbLink";
        GridView1.DataSource = bc.GetDataSet(strSql,"tbLink");
        GridView1.DataKeyNames = new string[] { "id" };
        GridView1.DataBind();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string strSql = "delete from tbLink where id='" + GridView1.DataKeys[e.RowIndex].Value + "'";
        bc.ExecSql(strSql);
        Response.Write(bc.MessageBox("删除成功!"));
        //再次绑定数据
        GridView1.DataSource = bc.GetDataSet("select * from tbLink", "tbLink");
        GridView1.DataBind();
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //提醒用户是否真的要删除
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            // e.Row.Cell[x]   -->  x值: 指的是此删除命令按扭位于的列索引( 把列号减去1 ),若为第5列,则x=4;
            ((LinkButton)(e.Row.Cells[3].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
        }

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover", "currentColor=this.style.backgroundColor;this.style.backgroundColor='#aabbcc'");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentColor");
        }
    }
}

⌨️ 快捷键说明

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