Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Datagrid, two fields into one column


Message #1 by "Bob" <bob@l...> on Mon, 22 Oct 2001 18:29:58
Finally found the solution I was looking for !  The solution is to use a 
TemplateColumn, with an ItemTemplate and label.  It is actually quite easy.
Lou, suggested having the sql concatenate the fields, but unfortunately I 
was using a common stored procedue and didn't want to change it, but if I 
hadn't found this solution then changing the sql would have worked.  Here 
it is:

<asp:TemplateColumn HeaderText="test">
 <ItemTemplate>
  <asp:Label Runat="server" 
   text='<%# DataBinder.Eval(Container.DataItem,"lastname") + _
    " " + _
    DataBinder.Eval(Container.DataItem,"firstName") %>'>
  </asp:Label>
 </ItemTemplate>
</asp:TemplateColumn>

thanks
Bob Horkay

  Return to Index