我无法从 datagrid 检索不可见列的值。如果列不可见,如何获取值?
这是我的代码:
数据网格:
<asp:BoundField DataField="id" HeaderText="ID" ReadOnly="True"
Visible="False" />
<asp:BoundField DataField="category" HeaderText="Category" />
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ShowHeader="True" />
行删除事件
protected void dgvCategory_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string id = dgvCategory.Rows[e.RowIndex].Cells[0].Text;
string name = dgvCategory.Rows[e.RowIndex].Cells[1].Text;
runDelete(id, name);
loadDataCategory();
}
我该如何解决我的问题?