标题:求大神指教 我这里面的删除不好用 怎么改呢
取消只看楼主
gmghqyy
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2014-5-7
结帖率:0
已结贴  问题点数:20 回复次数:3 
求大神指教 我这里面的删除不好用 怎么改呢
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 Datas_index_dw : System.Web.UI.Page
{
    DataBase db = new DataBase();
    String sql = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["ano"] == null)
            {
                Response.Write("<script> javascript:alert('请先登录!'); </script>");
                Response.Redirect("../login.aspx");
            }
            else
            {
                sql = "select * from dw";
                getdata(sql);
            }
        }
    }
    private void getdata(string sql)
    {
        DataSet result = db.Getdata(sql);
        if (result != null)
        {
            if (result.Tables[0].Rows.Count > 0)
            {
                GridView1.DataSource = result.Tables[0];
                GridView1.DataKeyNames = new string[] { "dno" };
                GridView1.DataBind();
            }
            else
            {
                Response.Write("<script> javascript:alert('没有相关记录'); </script>");
                GridView1.DataSource = result.Tables[0];
                GridView1.DataKeyNames = new string[] { "dno" };
                GridView1.DataBind();
            }
        }
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Cells[6].Attributes.Add("onclick", "return confirm('你确认要删除吗?')");
            
        }
      
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        GridView1.DataBind();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {

    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int index = Int32.Parse(());
        string id = GridView1.Rows[index].Cells[1].Text;
        if ( == "edits")
        {
           Response.Redirect("modify_dw.aspx?id=" + id);
        }
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}



删除点了之后弹出是否确认删除 点确认之后无效果 不知道错在哪里了求解
搜索更多相关主题的帖子: public 
2014-05-07 15:09
gmghqyy
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2014-5-7
得分:0 
求教啊~~
2014-05-07 15:29
gmghqyy
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2014-5-7
得分:0 
回复 3 楼 xydddaxia
不行啊亲 改了之后点删除还是没反应啊
2014-05-07 16:07
gmghqyy
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2014-5-7
得分:0 
回复 5 楼 xydddaxia
老样子额。。。。哭
2014-05-07 18:15



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-431149-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.056045 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved