无法获得gridview单元格的值。我动态地绑定gridview
<asp:Panel ID="PnlGrid" runat="server" ScrollBars="Both" CssClass="gridLayout">
<asp:GridView ID="grdExamReportBatchWise" runat="server" CssClass="gridReport" AutoGenerateColumns="false">
<Columns>
</Columns>
<EmptyDataTemplate>
Records not present !
</EmptyDataTemplate>
</asp:GridView>
</asp:Panel>
for (int i = 0; i < grdExamReportBatchWise.Columns.Count - 1; i++)
{
if (grdExamReportBatchWise.Rows[0].Cells[i].Text == "Paper")
{
string ne = "abc";
}
}
答案 0 :(得分:0)
试试吧,
protected void grdExamReportBatchWise_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.DataItem != null)
{
for (int i = 0; i < grdExamReportBatchWise.Columns.Count - 1; i++)
{
if (e.Row.Cells[i].Text == "Paper")
{
string ne = "abc";
}
}
}
}