如何获得网格单元格值

问题描述:

如何在asp.net中获取网格单元值





how to get grid cell value in asp.net


<asp:TemplateField HeaderText="Amount">
<itemtemplate>
     <asp:Label ID="lblPackAmount" runat="server" Text='<%#Eval("PackageAmount")%>' 

</itemtemplate>

If it's a BoundField you could do

gv.Rows[1].Cells[1].Text;
If it's a TemplateField, you have to get the control that has the value you want.

Label L = gv.Rows[1].FindControl("yourcontrolId") as Label;
L.Text;