Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to have two datafield on one column of a gridview? Example on my database I have firstname and lastname, basically i want in grid view is that they are in the same columns with the header field "Name". Should i use template field? like this one?(my guess)
XML
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="lblId" runat="server" Text='<%# Eval("Firstname")%>'> </asp:Label>
<asp:Label ID="lblId" runat="server" Text='<%# Eval("Lastname")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>

and if I use that code can i add space between them? Thanks and more power sirs madams
Posted

Yes You can use in this way.
you can also include space between them
pressing space button on keyboard will not work you need to use

&nbsp;
 
Share this answer
 
v2
Comments
janwel 29-Sep-11 2:15am    
so sir my code above really works?
janwel 29-Sep-11 2:16am    
thanks sir
P.Salini 29-Sep-11 2:21am    
I am not sir
i am madam
janwel 29-Sep-11 2:23am    
thank sis ^_^
you can Use &nbsp; between two labels
 
Share this answer
 
v2
Comments
janwel 29-Sep-11 2:16am    
thanks sir

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900