我的网格视图数据绑定像这样:
<asp:TemplateField HeaderText="COMPANY NAME">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "Company_Name")%>
</ItemTemplate>
</asp:TemplateField>
答案 0 :(得分:0)
您需要将控件转换为DataBoundLiteralControl
,如:
foreach (GridViewRow item in GridView1.Rows)
var yourValue = (item.Cells[0].Controls[0] as DataBoundLiteralControl).Text;