Solution:
GridView BoundField can only bind to a single field. If you want to do this, you can do so by one of the following ways:
> use calculated column in your database query i.e. concatenate multiple columns to a single column. For example: Select housenumber+', '+street as Address from client
> use GridView TemplateField. You can bind individual template in a single TempalteField. Following code snippet shows the trick:
<asp:GridView ID="GridView1" runat="server"> <Columns> <asp:TemplateField HeaderText="Address"> <ItemTemplate> <%#Eval("housenumber")%>, <%#Eval("street")%> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>
No comments:
Post a Comment