gridview中的单元格单击事件 [英] cell click event in gridview

查看:1098
本文介绍了gridview中的单元格单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击网格视图单元格时,如何在消息框中动态显示存在于网格视图单元格中的消息

How to show a message that is present in grid view cell dynamically in a message box when ever i click on the grid view cell

推荐答案

尝试类似的方法:
Try something like:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
  if (e.Row.RowType == DataControlRowType.DataRow)
  {
    LinkButton l = (LinkButton)e.Row.FindControl("LinkButton1");
    l.Attributes.Add("onclick", "javascript:return " +
    "confirm('Are you sure you want to delete this record? "+ "')");
  }
}


您可以使用它,如果不是,请解释您的问题,以便我提出任何解决方案.

you can use it, if it is not then please explain your question, so that i can suggest any solution.

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            MessageBox.Show(this.dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString());
        }


这篇关于gridview中的单元格单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆