2

在 RowDataBound OnClick 事件处理程序中,'Hi'当我单击任何行时会打印它。但我希望它只在我点击第 15 行时打印“嗨”。我该如何实施?

我的代码:

protected void dtvExDetails_RowDataBound1(object sender, GridViewRowEventArgs e)
{

    if (e.Row.DataItemIndex == -1)
        return;

    e.Row.Attributes.Add("onMouseOver","this.style.cursor='hand';");
    e.Row.Attributes.Add("onclick", this.GetPostBackClientEvent(dtvExDetails, "Select$15"));
}


protected void dtvExDetails_SelectedIndexChanged(object sender, EventArgs e)
{
    Response.Write("hi");
    DataGrid();
}
4

1 回答 1

1
  protected void dtvExDetails_SelectedIndexChanged(object sender, EventArgs e)
    {
            GridViewRow selrow = sender as GridViewRow;

            if(selrow.Count == 15)
                Response.Write("hi");
            DataGrid();
    }
于 2008-12-18T08:18:33.597 回答