我想通过单击网格视图单元格来执行一些操作。我知道行单击并获取整行数据,但我无法获得颗粒细胞事件。

正如我们在上面的网格视图中所看到的,我想对颗粒细胞数量执行操作。
谢谢
发布于 2018-06-12 06:01:44
像这样添加一个on RowDataBound
protected void Gridview_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[1].Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gridview, "Select$" + e.Row.RowIndex);
}
}您可以按其索引(如单元格1的
e.Row.Cells[1])给出单元格。
您可以得到任何像这样的selected row cell值
protected void Gridview_SelectedIndexChanged(object sender, EventArgs e)
{
string designation = Gridview.SelectedRow.Cells[0].Text;
}https://stackoverflow.com/questions/50810106
复制相似问题