asp.net gridview简单问题希望有人可以回答^ _ ^

asp.net gridview简单问题希望有人可以回答^ _ ^

问题描述:

是否有可能在gridview的一列上有两个数据字段?在我的数据库上,我有名字和姓氏,在网格视图中,基本上我希望它们位于与标题字段名称"相同的列中.我应该使用模板字段吗?喜欢这个吗?(我猜)

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)

<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>


如果我使用该代码,是否可以在它们之间添加空间?谢谢,谢谢您.madams


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

是的.您可以通过这种方式使用.
您还可以在它们之间包含空格
按键盘上的空格键将不起作用,您需要使用

& nbsp;
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;


,您可以使用& nbsp;在两个标签之间
you can Use &nbsp; between two labels