日期:2014-05-19  浏览次数:20798 次

低级问题,dataview按钮列对应行的取值问题。
dataview中有一个按钮列,点击按钮如何获取按钮对应的行某一单元格的值,谢谢!!!

------解决方案--------------------
sorry 没看清是gridview

<%@ Page language= "C# " %>

<script runat= "server ">

void CustomersGridView_SelectedIndexChanged(Object sender, EventArgs e)
{

// Get the currently selected row using the SelectedRow property.
GridViewRow row = CustomersGridView.SelectedRow;

// Display the company name from the selected row.
// In this example, the third column (index 2) contains
// the company name.
Message.Text = "You selected " + row.Cells[2].Text + ". ";

}