DataGrid problem - Combine 2 fields

  • Thread starter CuMPeEWeEr [No MCSD]
  • Start date
C

CuMPeEWeEr [No MCSD]

I am trying to combine FirstName and LastName to display in one column on
DataGrid, but it gave me an error saying "Preprocessor directives must
appear as the first non-whitespace character on a line". How should I do
this?

<asp:DataGrid ....
<columns>
<asp:TemplateColumn...>
<ItemTemplate>

<asp:literal id="Name" runat="server" Text='<%# DataBinder.Eval(Container,
"DataItem.FirstName") %><%# DataBinder.Eval(Container, "DataItem.LastName")
%>' />

........
 
L

Lars Netzel

You don't need the literal Control!

Just type:

<%# DataBinder.Eval(Container,"DataItem.FirstName") %>&nbsp;<%#
DataBinder.Eval(Container, "DataItem.LastName")%>' />

/Lars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top