-1

i am fed up with this Syncfusion Controls, these are very difficult compared to normal datagridview. where is the Datapropertyname in Syncfusion GridControl. how to bind Data to Grid Control.

gridControl1.ColStyles[3].DataSource = dt1; 
gridControl1.ColStyles[3].DisplayMember = "bcmp_Name"; gridControl1.ColStyles[3].ValueMember = "bcmp_Id"; 
gridControl1.ColStyles[3].DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Exclusive;
gridControl1.ColStyles[5].DataSource = dt2; 
gridControl1.ColStyles[5].DisplayMember = "bcmp_Name"; 
gridControl1.ColStyles[5].ValueMember = "bcmp_Id"; 
gridControl1.ColStyles[5].DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Exclusive;
gridControl1.ColStyles[7].DataSource = dt3; 
gridControl1.ColStyles[7].DisplayMember = "bcmp_Name"; gridControl1.ColStyles[7].ValueMember = "bcmp_Id"; 
gridControl1.ColStyles[7].DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Exclusive;
gridControl1.ColStyles[9].DataSource = dt4; 
gridControl1.ColStyles[9].DisplayMember = "bcmp_Name"; 
gridControl1.ColStyles[9].ValueMember = "bcmp_Id"; 
gridControl1.ColStyles[9].DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Exclusive;
gridControl1.TableStyle.DataSource = Chldtbl;

By using the above code i am not able to bind it, i am not getting in any one of their links.

Evan L
  • 3,805
  • 1
  • 22
  • 31
Anjali
  • 1,680
  • 4
  • 26
  • 48
  • I don't know these controls well, but it looks like you are binding to *styles* rather than *data*. Is there a `gridControl1.DataSource` property? – Evan L Apr 18 '14 at 14:55
  • @EvanL you think i am not famliar with windows controls. i know well. for datagridview we write DataGridView.DataSource but here there is no chance.for that i given like that – Anjali Apr 18 '14 at 16:36
  • We obviously have a language barrier here. I was saying that **i don't** know this control. And was asking if it had that property. Obviously it doesn't. Sorry I can't help you more. – Evan L Apr 18 '14 at 17:28

2 Answers2

0

It looks like you are using the wrong grid control. Use the Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl or Syncfusion.Windows.Forms.Grid.GridDataBoundGrid controls for direct data binding.

If you really want to use the Syncfusion.Windows.Forms.Grid.GridControl, then you can use it in virtual mode. Look at the QueryColCount, QueryRowCount, QueryCellInfo, and QueryCellFormattedText events. QueryCellInfo is where you should set the styles and values. If you want to do do two-way binding, also see the SaveCellInfo event.

Doug
  • 281
  • 2
  • 6
0

As suggested by Doug, the best way for data binding is to use the GridGrouping or GridDataBound control. If you still want to use the GridControl then we suggest you to use the PopulateValues method for binding the data. Please refer the below code snippet and UG link for more details.

C#:
this.gridControl1.BeginUpdate();
this.gridControl1.RowCount = this.numArrayRows;
this.gridControl1.ColCount = this.numArrayCols;



// Call PopulateValues Method to move values from a given data source (this.initArray) into the Grid Range specified.
this.gridControl1.Model.PopulateValues(GridRangeInfo.Cells(1, 1, this.numArrayRows, this.numArrayCols), this.intArray);
this.gridControl1.EndUpdate();
this.gridControl1.Refresh();

UG link: http://help.syncfusion.com/ug/windows%20forms/grid/documents/thegridcontrolpopula.htm

Also you can make use of the Virtual Grid for binding data to your grid. Virtual grids can display large amounts of data extremely fast. Please refer the below UG link for more details regarding Virtual Grid.

UG Link: http://help.syncfusion.com/ug/windows%20forms/grid/documents/virtualgrids.htm

Regards, Anish