DataBinding
Hi,
Is it possible for me to databind each cell to a n object. For example, if I have a class MyClass with a MyValue property can I set something like this.
MyClass c = new MyClass();
c.MyValue = "Test";
m_Grid[3, 2].DataSource = c
m_Grid[3, 2].DisplayMember = "MyValue";
m_Grid[3, 2].ValueMember = "MyValue";
thanks
thanvir
Is it possible for me to databind each cell to a n object. For example, if I have a class MyClass with a MyValue property can I set something like this.
MyClass c = new MyClass();
c.MyValue = "Test";
m_Grid[3, 2].DataSource = c
m_Grid[3, 2].DisplayMember = "MyValue";
m_Grid[3, 2].ValueMember = "MyValue";
thanks
thanvir
SIGN IN To post a reply.
4 Replies
TH
Thanvir Hussain
November 12, 2007 10:37 AM UTC
To add, I am using a GridControl not a databound grid control
>Hi,
Is it possible for me to databind each cell to a n object. For example, if I have a class MyClass with a MyValue property can I set something like this.
MyClass c = new MyClass();
c.MyValue = "Test";
m_Grid[3, 2].DataSource = c
m_Grid[3, 2].DisplayMember = "MyValue";
m_Grid[3, 2].ValueMember = "MyValue";
thanks
thanvir
>Hi,
Is it possible for me to databind each cell to a n object. For example, if I have a class MyClass with a MyValue property can I set something like this.
MyClass c = new MyClass();
c.MyValue = "Test";
m_Grid[3, 2].DataSource = c
m_Grid[3, 2].DisplayMember = "MyValue";
m_Grid[3, 2].ValueMember = "MyValue";
thanks
thanvir
JJ
Jisha Joy
Syncfusion Team
November 12, 2007 02:18 PM UTC
Hi Thanvir,
Thank you for posting query to us.
You can use CellValue property of GridControl to set value to particular cell instead of using DataSource property.
Here is the code snippets:
Please refer the sample in the link to illustrate this:
http://websamples.syncfusion.com/samples/Grid.Windows/69770/main.htm
Please try this and let me know if this helps.
Regards,
Jisha
Thank you for posting query to us.
You can use CellValue property of GridControl to set value to particular cell instead of using DataSource property.
Here is the code snippets:
clsData c1 = new clsData();
c1.Name = "Test";
gridControl1[2, 2].CellValue = c1.Name;
Please refer the sample in the link to illustrate this:
http://websamples.syncfusion.com/samples/Grid.Windows/69770/main.htm
Please try this and let me know if this helps.
Regards,
Jisha
TH
Thanvir Hussain
November 12, 2007 05:16 PM UTC
Hi,
I don't think you got what I was trying to convey. I was databinding a object to a cell meaning any changes done in the cell should automatically posted back to the object and vice versa.
I am now using the cellvalue property only but everytime my business object changes I have to set back the cellvalue. If I have a winform textbox then I can directly databind the object then all the intractions will be done automatically.
Hope I am clear this time.
thanks
tahnvir
>Hi Thanvir,
Thank you for posting query to us.
You can use CellValue property of GridControl to set value to particular cell instead of using DataSource property.
Here is the code snippets:
Please refer the sample in the link to illustrate this:
http://websamples.syncfusion.com/samples/Grid.Windows/69770/main.htm
Please try this and let me know if this helps.
Regards,
Jisha
I don't think you got what I was trying to convey. I was databinding a object to a cell meaning any changes done in the cell should automatically posted back to the object and vice versa.
I am now using the cellvalue property only but everytime my business object changes I have to set back the cellvalue. If I have a winform textbox then I can directly databind the object then all the intractions will be done automatically.
Hope I am clear this time.
thanks
tahnvir
>Hi Thanvir,
Thank you for posting query to us.
You can use CellValue property of GridControl to set value to particular cell instead of using DataSource property.
Here is the code snippets:
clsData c1 = new clsData();
c1.Name = "Test";
gridControl1[2, 2].CellValue = c1.Name;
Please refer the sample in the link to illustrate this:
http://websamples.syncfusion.com/samples/Grid.Windows/69770/main.htm
Please try this and let me know if this helps.
Regards,
Jisha
HA
haneefm
Syncfusion Team
November 12, 2007 08:52 PM UTC
Hi Thanvir ,
The grid does not support simple binding to a single grid cell. But you can get this behavior by using the Control celltype in a grid cell. Below is a forum thread that discuss with the similar issue.
http://www.syncfusion.com/support/forums/message.aspx?&MessageID=59487
Please try this and let me know if this helps.
Best regards,
Haneef
The grid does not support simple binding to a single grid cell. But you can get this behavior by using the Control celltype in a grid cell. Below is a forum thread that discuss with the similar issue.
http://www.syncfusion.com/support/forums/message.aspx?&MessageID=59487
Please try this and let me know if this helps.
Best regards,
Haneef
SIGN IN To post a reply.
- 4 Replies
- 3 Participants
-
TH Thanvir Hussain
- Nov 12, 2007 10:32 AM UTC
- Nov 12, 2007 08:52 PM UTC