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
15
Ultra grid Single Cell Select (Need Help Urgent)
posted

My problem is, when I tab through the controls and go to Ultra grid, it selects the entire row, but I only want to get the focus only on the check box and make a selection by hitting space bar, but as of now when I hit the space bar or tab or left or right down or up arrow it won't check the check box instead it keeps scrolling to the next row and so on. Can someone please help me with the sample code to just select the check box and able to check the check box with the space bar.

By the way, the check box is dynamic (please see the designer view image attached). Here is the code in the grid initialization I used (I know I commented lot of lines as I tried lot of options but none worked for me).

private void grdEmployeeRoles_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
try
{
UiHelper.SetDefaultUltraGridLayout(e.Layout);
UiHelper.SetGlobalGridSettings(grdEmployeeRoles);
if (grdEmployeeRoles.Rows.Count >= 0)
{
if (!e.Layout.Bands[0].Columns.Exists("Role_Selected"))
{
e.Layout.Bands[0].Columns.Insert(1, "Role_Selected");
}
this.grdEmployeeRoles.DisplayLayout.Bands[0].Columns["Role_Selected"].TabIndex = 0;
this.grdEmployeeRoles.DisplayLayout.Bands[0].Columns["Role_ID"].TabIndex = 1;
this.grdEmployeeRoles.DisplayLayout.Bands[0].Columns["Role_Description"].TabIndex = 2;
this.grdEmployeeRoles.DisplayLayout.Bands[0].Columns["Predefined"].TabIndex = 3;
foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn grdEmployeeRolesColumn in e.Layout.Bands[0].Columns.All)
{
switch (grdEmployeeRolesColumn.Key)
{
case CTASConstants.OfficialsRoleID:
grdEmployeeRolesColumn.Hidden = true;
grdEmployeeRolesColumn.Header.Caption = "Role ID";
//grdEmployeeRolesColumn.CellActivation = Activation.NoEdit;
break;

case CTASConstants.OfficialsRoleSelected:
grdEmployeeRolesColumn.DataType = typeof(Boolean);
grdEmployeeRolesColumn.Hidden = false;
grdEmployeeRolesColumn.Width = 150;
grdEmployeeRolesColumn.MaxWidth = 100;
grdEmployeeRolesColumn.MinWidth = 100;
grdEmployeeRolesColumn.Header.Caption = "Employee's Role";
//grdEmployeeRolesColumn.CellActivation = Activation.AllowEdit;
grdEmployeeRolesColumn.CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center;

break;

case CTASConstants.OfficialsRolePredefined:
grdEmployeeRolesColumn.Hidden = true;
grdEmployeeRolesColumn.Header.Caption = "Predefined";
grdEmployeeRolesColumn.CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center;
//grdEmployeeRolesColumn.CellActivation = Activation.NoEdit;
//grdEmployeeRolesColumn.CellClickAction = CellClickAction.RowSelect;
break;

case CTASConstants.OfficialsRoleDescription:
grdEmployeeRolesColumn.Hidden = false;
grdEmployeeRolesColumn.Width = 150;
grdEmployeeRolesColumn.MinWidth = 150;
grdEmployeeRolesColumn.Header.Caption = "Role Description";
//grdEmployeeRolesColumn.CellActivation = Activation.NoEdit;
//grdEmployeeRolesColumn.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.FormattedText;
//grdEmployeeRolesColumn.CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
//grdEmployeeRolesColumn.CellClickAction = CellClickAction.RowSelect;
break;
}
}
//e.Layout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;
//this.grdEmployeeRoles.DisplayLayout.Override.ActiveCellAppearance.Reset();
//this.grdEmployeeRoles.DisplayLayout.Override.ActiveRowAppearance.Reset();
//grdEmployeeRoles.ActiveRow = grdEmployeeRoles.Rows[0];
//grdEmployeeRoles.ActiveRow = null;
//this.grdEmployeeRoles.DisplayLayout.Override.ActiveAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False;
//grdEmployeeRoles.DisplayLayout.Override.SelectedAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False;
e.Layout.Override.SelectTypeRow = SelectType.None;
this.grdEmployeeRoles.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
}
grdEmployeeRoles.DisplayLayout.TabNavigation = TabNavigation.NextControlOnLastCell;
}
catch (Exception ex)
{
ExceptionLogger.WriteLogFile(ex, true);
}
finally
{
}
}

private void grdEmployeeRoles_Enter(object sender, EventArgs e)
{
try
{
grdEmployeeRoles.PerformAction(UltraGridAction.EnterEditMode);
grdEmployeeRoles.DisplayLayout.Override.SelectTypeRow = SelectType.None;
//grdEmployeeRoles.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
grdEmployeeRoles.DisplayLayout.Bands[0].Columns["Role_Selected"].CellActivation = Activation.AllowEdit;
//grdEmployeeRoles.DisplayLayout.Bands[0].Columns["Role_Description"].CellActivation = Activation.Disabled;
//grdEmployeeRoles.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.None;

}
catch (Exception ex)
{
ExceptionLogger.WriteLogFile(ex, true);
}
}

Parents
No Data
Reply
  • 7535
    Offline posted

    Hello Gopi, 

    First I would like to know which version of controls you are using? From where you got this checkbox , what do you mean by dynamic?Do you have rowSelector or you are talking about a checkbox column?

    I noticed that you set TabNavigation to NextControlOnLastCell, and this will select the entire row.

    I believe for fast and better understanding share your sample, or I attached my sample here you can modify it  with your dynamic checkbox to understand your requirement.

Children
No Data