我记得在beta2版时出现过这种问题,到了正式版一切正常

解决方案 »

  1.   

    你可以在itemcommand事件里试试private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    switch(e.CommandName)
    {
                    case "Select":
    //code
    break;
    }
    }
      

  2.   

    还要写代码啊
    给个例子
    private void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    try
    {
    ErrorMessage.Text = "";
    SqlCommand delCommand = new SqlCommand();
    delCommand.Connection = sqlConnection1;
    delCommand.CommandText = "DELETE FROM Customers WHERE CustomerID = '" + e.Item.Cells[2].Text + "'";
    delCommand.CommandType = CommandType.Text;
    sqlConnection1.Open();
    delCommand.ExecuteNonQuery();
    sqlDataAdapter1.Fill(dataSet1);
    Cache["CustomerData"] = dataSet1;
    bindGrid();
    sqlConnection1.Close();
    }
    catch (Exception ex)
    {
    ErrorMessage.Text = ex.Message;
    }
    }