Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
795
Using usercontrol in Grid.
posted

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.

Parents Reply Children
No Data