How to add several table columns in one DataGrid Column?
Is there any possibility to diplay several columns of a table in one column of a DataGrid?
eg: I heve a table with the below Columns:
- IDEmployee
- Name
- LastName
- SecondLastName
So, in a DataGrid, in the first column I want to display the ID, and in the second column I want to diplay the complete name (Name, LastName n' SecondLastName)
is it possible?
thanx in advance.
Regards.
Carlos SanchezPosted Oct 6, 2004, 11:39 AM
jsheplerPosted Oct 6, 2004, 11:01 AM
Employee
<%# DataBinder.Eval(Container.Dataitem, "Name") %>
<%# DataBinder.Eval(Container.Dataitem, "LastName") %>
<%# DataBinder.Eval(Container.Dataitem, "SecondLastName") %>
The first method is the preferred way unless you need to have the columns seperate for something else. Having the database doing the work is much more efficient, not to mention easier to code.