Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bind Multiple Properties - DataGridView

2 views
Skip to first unread message

VijayRama

unread,
Jul 18, 2011, 10:18:34 AM7/18/11
to
Hi,

In a cell of datagridview,I need to display three different text. The
value of this text can be obtained from three different properties.
How do I bind these three properties. Using "DataPropertyName" I am
able to bind only one property.

Class A
{

string Name
{
get;set;
}
string Type

{
get;set;
}
string Index
{
get;set;
}

}

DataGridViewColumn Column1 = new DataGridViewColumn();
indexColumn.DataPropertyName = "Index";
dataGrid1.Columns.Add(indexColumn);
List<Class A> classAList=new List<ClassA>();
classAList.Add(obj);
classAList.Add(obj1);
dataGrid1.DataSource=classAList;
This binds "Index" property of the Class A to column1. So each cell in
this column will display the index value.

But I need to display value of all three properties in a single cell
as shown below.


Column1

//Cell1 of this column
Text1(Name)
Text2(Type)
Text3(Index)

//Cell2 of this column
Text1(Name)
Text2(Type)
Text3(Index)

//Cell3
Text1(Name)
Text2(Type)
Text3(Index)

//Cell 4
Text1(Name)
Text2(Type)
Text3(Index)

How can I do this?

Thanks in Advance for your help.

0 new messages