我在获取模板字段值时遇到了问题; Gridview在ContentPlaceHolder1中;
我试图在GridView1_RowCreated事件中获取值
int RowIndex = GridView1.Rows.Count - 1;
GridView1.Rows[RowIndex].Cells[0].Text = " " + AltKatLinkler;
但是这段代码返回了 null 或空值。
这是我的列,列索引为 0。 注意:我使用 SqlDataSource 填充 GridView。在浏览器中,我可以看到行内容,但无法从 codebehind 访问。
<asp:templatefield headertext="Haberler" sortexpression="KategoriID" xmlns:asp="#unknown">
<ItemTemplate>
< a href='<%# "KategoriGoster.aspx?KategoriID=" + Eval("KategoriID")%>'>
<%# Eval("KategoriAd")%>
<%# Eval("Açıklama")%>
</ItemTemplate>
</asp:TemplateField>