Hi,
I want to set the Grid using Code behind. (nothing to use Grid Designer, *.cs file).
Setting operations like blow function.
1. Setting Column
1.1 Set the Column Head to Multi-Lines (2~3 Level)
1.1 Set the Column (Title/Width/Datatype/Fixed Columns)
2. Data Binding to Grid
2.1 if i set Multi-Columns Head, How can i set Data to Grid Cells.
Would you Help me the example or sample?
Thanks
Hello ecogear,
I tried to wrap up a small sample for you, to demonstrate the desired requirements. I am not sure only for the last requirement. Could you please review my sample and let me know if I misunderstood you.
Thanks for your help.
I see Your Example.
I think My Question is poor, then additionally I want to know the below things.
Can I set the Grid (like attached File) by Only Code Behind?
Here is a code sample which I believe could help you:
noCol.Header.VisiblePosition = 0; noCol.RowLayoutColumnInfo.OriginX = 0; noCol.RowLayoutColumnInfo.OriginY = 0; noCol.RowLayoutColumnInfo.PreferredLabelSize = new System.Drawing.Size(0, 48); noCol.RowLayoutColumnInfo.SpanX = 2; noCol.RowLayoutColumnInfo.SpanY = 4; userNameCol.Header.VisiblePosition = 1; userNameCol.RowLayoutColumnInfo.OriginX = 2; userNameCol.RowLayoutColumnInfo.OriginY = 0; userNameCol.RowLayoutColumnInfo.PreferredCellSize = new System.Drawing.Size(196, 0); userNameCol.RowLayoutColumnInfo.SpanX = 4; userNameCol.RowLayoutColumnInfo.SpanY = 2; ageCol.Header.VisiblePosition = 2; ageCol.RowLayoutColumnInfo.OriginX = 2; ageCol.RowLayoutColumnInfo.OriginY = 2; ageCol.RowLayoutColumnInfo.SpanX = 2; ageCol.RowLayoutColumnInfo.SpanY = 2; sexCol.Header.VisiblePosition = 3; sexCol.RowLayoutColumnInfo.OriginX = 4; sexCol.RowLayoutColumnInfo.OriginY = 2; sexCol.RowLayoutColumnInfo.SpanX = 2; sexCol.RowLayoutColumnInfo.SpanY = 2; deptCol.Header.VisiblePosition = 4; deptCol.RowLayoutColumnInfo.OriginX = 6; deptCol.RowLayoutColumnInfo.OriginY = 0; deptCol.RowLayoutColumnInfo.PreferredLabelSize = new System.Drawing.Size(0, 48); deptCol.RowLayoutColumnInfo.SpanX = 2; deptCol.RowLayoutColumnInfo.SpanY = 4; ultraGridBand1.Columns.AddRange(new object[] { noCol, userNameCol, ageCol, sexCol, deptCol}); ultraGridBand1.RowLayoutStyle = Infragistics.Win.UltraWinGrid.RowLayoutStyle.ColumnLayout;
If you are not able to implement this code in your project please let me know, I will provide a sample for you.
I wanted to know if you were able to solve your issue based on these suggestions or you still need help. Please let me know.
Hello Boris
thank you for your assistance. i solve my issue.