{cell}.Text will only work if there is no control in the TemplateField . You added a shortcut to your template, so you first need to find the control, apply your object to the control, and access the control properties as needed.
If you want to use a more general approach, you can always do the following (remove the label control and just add the field to be evaluated):
<Columns> <asp:TemplateField HeaderText="Customer Name"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "Customer.Name")%> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="PickUpPoint"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "Pickuppoint")%> </ItemTemplate> </asp:TemplateField> </Columns>
When you use the originally used code, {cell}.Text no longer return empty.
source share