Hi, I need to create a winforms ultra grid with a column that has three radio buttons with captions in each cell : Yes / No / Not Sure.
When the user selects all the answers and presses the "Done" button, I will do some processing for each row.
I wonder if there is a good sample out there of how this can be done.
Thanks,
Helen
Hi Helen,
Putting radio buttons in a cell is very easy. What you do is place an UltraOptionSet control the form with your grid. Populate the OptionSet with the items you want (Yes / No / Not Sure). Then you set the column's EditorComponent property to the UltraOptionSet control.
When the user selects an option, the cells value will be set to the Value of the selected item in the OptionSet.
Hi..
There is no EditorComponent property in "NetAdvantage for .NET 2008 Vol. 1 CLR 2.0". Please suggest solution for this version .
The EditorComponent property replaced the EditorControl property.
Hi Mike,
Thanks for quick replay. I have using this property,code was run successfully but at run time there is no radio button in grid.
Please look into following code :
Problem Statement : Creating ultrawingrid at run time with radio button in one column (Yes/No/Not Sure)
Sample Code :Infragistics.Win.UltraWinGrid.UltraGrid ultraAnswerGrid = new UltraGrid(); //Initilization ultraAnswerGrid.DisplayLayout.Bands[0].Columns.ClearUnbound(); ((System.ComponentModel.ISupportInitialize)(this.ultraAnswerGrid)).BeginInit(); this.SuspendLayout(); //make column Infragistics.Win.UltraWinGrid.UltraGridColumn dgColumn = null; dgColumn = new UltraGridColumn("56"); dgColumn.Key = "56"; //Create a new instance of the UltraOptionSet UltraOptionSet ultraOptionSet1 = new UltraOptionSet(); //Create the necessary ValueListItems to represent each of the desired options Infragistics.Win.ValueListItem valueListItem1 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem2 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem3 = new Infragistics.Win.ValueListItem(); //Assign a data value for each option valueListItem1.DataValue = "Yes"; valueListItem2.DataValue = "No"; valueListItem3.DataValue = "Not Sure"; //Assign the text which will be displayed within the UltraGrid for each option valueListItem1.DisplayText = "Yes"; valueListItem2.DisplayText = "No"; valueListItem3.DisplayText = "Not Sure"; //Add each ValueListItem object to the items collection of the ultraOptionSet ultraOptionSet1.Items.AddRange(new Infragistics.Win.ValueListItem[] { valueListItem1, valueListItem2, valueListItem3 }); //Set the UltraOptionSet instance as the EditorComponent for the first column of the UltraGrid ultraAnswerGrid.DisplayLayout.Bands[0].Columns.Add(dgColumn); ultraAnswerGrid.DisplayLayout.Bands[0].Columns[0].EditorControl = ultraOptionSet1; ultraAnswerGrid.Width = 1000; this.Controls.Add(ultraAnswerGrid); this.ultraAnswerGrid.Location = new Point(0, 0); ((System.ComponentModel.ISupportInitialize)(this.ultraAnswerGrid)).EndInit(); this.ResumeLayout(false);
Platform : "NetAdvantage for .NET 2008 Vol. 1 CLR 2.0
I don't see anything wrong with this code snippet, but it's hard to tell much from a snippet. Can you post a small sample project?