Live Chat Icon For mobile
Live Chat Icon

Is there a way to show more than one datafield in a column when using a datagrid?

Platform: ASP.NET| Category: DataGrid

Yes. Use a TemplateColumn in a DataGrid


<asp:DataGrid id='DataGrid1' runat=server AutoGenerateColumns=False>
	<Columns>
		<asp:TemplateColumn HeaderText='Field'>
			<ItemTemplate>
				<%#DataBinder.Eval(Container.DataItem, 'Field1').ToString()%> - <%#DataBinder.Eval(Container.DataItem, 'Field2').ToString()%>
			</ItemTemplate>
		</asp:TemplateColumn>
	</Columns>
</asp:DataGrid>

Share with

Share on twitter
Share on facebook
Share on linkedin