数据未在数据网格视图中显示
objWorOrder = new WorkOrderBAL();
objProperties = new OMSProperties();
objProperties.SO = txtsono.Text;
DataTable dt = objWorOrder.GetDetail(objProperties);// this is for sql database stored procedure
dgvActSG.DataSource = dt;
dgvActSG.AutoGenerateColumns = false;
int rcount = dt.Rows.Count;
if (dgvActSG.Rows.Count > 0)
{
var row = dgvActSG.Rows[0];
txtcustomer.Text = row.Cells[2].Value.ToString();
dgvActSG.CurrentCell = row.Cells[0]; //set focus to first cell in first row
}
else
{
MessageBox.Show("Invalid Number", "Error");
}
最佳答案
我猜你忘了绑定你的gridview
dgvActSG.DataSource = dt;
dgvActSG.DataBind();
dgvActSG.AutoGenerateColumns = false;
int rcount = dt.Rows.Count;
关于c# - 数据未在数据网格 View 中显示,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20136579/