By using UltraControlContainerEditor i added my usercontrol (usercontrol has two radio buttons (Yes and No)) and paste it into the grid's particular cell. My code goes like this,
public void Initialize(LibertyGridProperties gridProperties, LibertyGridColumn[] columnDetails) {
case GridColumnStyle.UserControl: if (colData.UserControlProperties.Component == "CodeVsDesc") { colGridFormat[ultraGrid1.DisplayLayout.Bands[0].Columns[colData.UserControlProperties.ColumnName].Key] = GRID_EDIT_FORMAT.GRID_EDIT_OPTION; isEditable = true; } break;
}
void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) {
case GRID_EDIT_FORMAT.GRID_EDIT_OPTION:
Infragistics.Win.UltraWinEditors.UltraControlContainerEditor optionButtonsContainer; CodeVsDescription optionButtonsEditor; CodeVsDescription optionButtonsRender;
optionButtonsContainer = new Infragistics.Win.UltraWinEditors.UltraControlContainerEditor(); optionButtonsEditor = new CodeVsDescription(); optionButtonsRender = new CodeVsDescription();
optionButtonsEditor.Size = new System.Drawing.Size(139, 39); optionButtonsEditor.Visible = false; optionButtonsEditor.AutoSize = true; optionButtonsRender.Size = new System.Drawing.Size(49, 39); optionButtonsRender.Visible = false; optionButtonsRender.AutoSize = true; optionButtonsContainer.EditingControl = optionButtonsEditor; optionButtonsContainer.RenderingControl = optionButtonsRender; e.Row.Cells[key].EditorComponent = optionButtonsContainer; e.Row.Cells[key].Activation = Activation.AllowEdit; break;
Whenever i add rows dynamically into the grid , I can see the usercontrol into the particular column of the added rows. But I can select only one radio button at a time. For example, If i have 3 rows, I select Yes radio button in the first row and try to select No button in the second row of the user control. Once i select No on the 2nd row, first rows Yes selection becomes invalid and unselected automatically. I need to figure out the cause of this issue.
If i select any radio button , i should able to say to grid about the button and row that has been selected. Which event i should choose in this case. I feel personally that grid cell only knows about the container that it holds as it implements IProvidesEmbeddableEditor and dont know what control (my usercontrol with radio button)container holds. Because i have this.ultraGrid1.BeforeEnterEditMode += new CancelEventHandler(ultraGrid1_BeforeEnterEditMode); event and it fires when i click on the container not while clicking on any of theradio button. Please advise me.
I need assistance immediately.
Is it mandatory to set EditorControlPropertyName or the RenderingControlPropertyName and the data type of the grid column. Yes I am saying that the radio button in row 1 is changing and i do not want that to happen.
Hi,
I'm having trouble understanding what you are asking here.
Are you saying that when you click on a radio button in row 2 that you want the radio button in row 1 to change?
Or are you saying that the radio button in row 1 is changing and you do not want that to happen?
The state of the radio buttons can only be determined by the value of the cell in the grid. I don't see anything in your sample code here that indicates what the data type of the grid column is. Nor do I see anything here that set the EditorControlPropertyName or the RenderingControlPropertyName. So I think the ControlContainerEditor is probably falling back to using the Text property of your UserControl and it doesn't seem likely that the Text property is what you want here.