Dar*_*ana 6 c# gridview boundfield rowcommand
我有这样BoundField一个GridView
<asp:BoundField DataField="ReportId" HeaderText="RId" Visible="false" />
Run Code Online (Sandbox Code Playgroud)
但是当我尝试在该字段中获取文本时,它返回空.
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;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我将BoundField's .Visible属性更改为,则返回正确的值true
COL*_*OLD 25
尝试使用客户端html隐藏这样的想法
<style type="text/css">
.hidden
{
display:none;
}
</style>
<asp:BoundField DataField="ReportId" HeaderText="RId" HeaderStyle-CssClass="hidden" >
</asp:BoundField>
Run Code Online (Sandbox Code Playgroud)