我有BoundField
这个GridView
<asp:BoundField DataField="ReportId" HeaderText="RId" Visible="false" />
但是当我尝试在该字段中获取文本时,它返回空。
protected void gvwReports_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "ViewSchedule")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = gvwReports.Rows[index];
string s = row.Cells[0].Text;
}
}
但是,如果我将BoundField's
.Visible
属性更改为true