datagrid's OOP support

D

David

If anyone has struggled with this, please respond. Thank you.

I have an arraylist of Employee as described below. Note that Employee has
a property called Name which is an object type (its properties are
FirstName, MiddleName, LastName).

I want to bind an arraylist of Employee to the datagrid and display each
employee's First, Middle, and Last Name. With the ASP.NET grid, this is all
I had to do for each of the columns

<%#DataBinder.Eval(Container.DataItem, "Name.FirstName")%>
<%#DataBinder.Eval(Container.DataItem, "Name.LastName")%>
<%#DataBinder.Eval(Container.DataItem, "Name.MiddleName")%>

The ASP.NET datagrid recognizes "Name.FirstName" as a column name and
populates the datagrid accordingly. With the win datagrid, I've tried to
set the column object's MappingName property to "Name.FirstName" without
success.

I couldn't be the first to try something like this. I have this sub object
classes all over my business layer and if the Infragistics web grid does not
support it, I am in serious yogurt. Thanks in advance.


public class Employee
{
private Name name = new Name();
public Name Name
{
get{return name;}
set{name = value;}
}
public Employee()
{
//
// TODO: Add constructor logic here
//
}
}

[Serializable]
public class Name
{
private string firstName;
private string lastName;

public string FirstName
{
get{return firstName;}
set{firstName = value;}
}

public string LastName
{
get{return lastName;}
set{lastName = value;}
}
}
 
S

Sijin Joseph

Hi David,

Can you tell me what gets displayed on the datagrid?
Have you set the DataGrid.TableStyles.MappingName to "ArrayList"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top