When a Gridview uses an object data source, that object may contain other objects.

How do I display a single value from the embedded object in my Gridview?

For example, I have a list of order line objects that I want to display in a GridView. The order line object contains another object which is product. But in my GridView, I only want to list the product name.




          <asp:GridView ID=gridView1 runat=server ....  
          <Columns> 
          <asp:TemplateField HeaderText=" Product"> 
          <EditItemTemplate> 
          
                   <asp:TextBox ID=Product runat=server 
                            Text= <%# Eval(" Product.ProductName ") %> >
                   </asp:TextBox>
          
          </EditItemTemplate>
          </asp:TemplateField>
          </Columns>
          </asp:GridView>
        








Copyright © 2006-2016, LQSystems,Inc. All rights reserved.


   Printer Friendly Page


Home