473,404 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

DataGrid problem - Combine 2 fields


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")
%>' />

........
Nov 19 '05 #1
1 1663
You don't need the literal Control!

Just type:

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

/Lars

"CuMPeEWeEr [No MCSD]" <Cu***************@yahoo.com> wrote in message
news:8b********************@rogers.com...

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")
%>' />

.......

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: tina.boroff | last post by:
I didn't know what to use as a title for this. Here is the scenario: I have a op.reqedit.php page. This page a form where you input data. In this page I have split a MySQL field. It is called...
8
by: mark | last post by:
Access2000 How do I write a query that combines the CTC field from each record below into one record? I need to concatenate the CTC field with a separator, like below: ...
1
by: snOOp | last post by:
I am trying to combine the data from two similar tables into one query, but I need for all of the records from both tables to show up and I want the ones that have matching 'emplid' to be combined...
8
by: Sue | last post by:
I have a datagrid populated with 6 visible read-only labels and several hidden fields. Below the datagrid, I have a table with various textboxes, dropdowns, etc. I've managed to decypher the...
2
by: Sky | last post by:
Hello: Another question about trying to wring functionality from a DataGrid... Have a DB table of "Contacts" -- 14 or more fields per record Show in datagrid -- but only 5 columns (First,Last,...
1
by: DzemoT. | last post by:
haw to bound datagrid column to two columns in database. Ex. i woan to use hyperlink column and show first and last name (two columns in database) in one column.
1
by: adam | last post by:
Hi I have a datagrid bound to a datareader. the datareader returns two columns authorId, and authorName. How do i combine the data to render one column with the name of the author as a hyperlink....
13
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever...
1
by: LSGKelly | last post by:
Hi all. I need to combine two fields that contain numbers that are in a currency format (Ex: $1,500 $3,500). When I combine them, I want them to look like this -- $1,500/$3,500. When I combine...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.