Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
285 views
in Technique[技术] by (71.8m points)

winforms - How to bind data to SyncFusion GridControl in C# using Windows Application?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...