We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Disable drill down in the grid

Thread ID:

Created:

Updated:

Platform:

Replies:

91503 Nov 20,2009 06:23 PM Dec 1,2009 01:36 AM Windows Forms 5
loading
Tags: GridControl
Sergey Merkuriev
Asked On November 20, 2009 06:23 PM

How to disable drill down in the Grid Grouping control?

I display in the grid collection of following objects

public class DataItem
{
public ICollection Attributes { get; private set; }
public string Name { get; private set; }
}

and I do not need display nested collection of Attributes in the grid. How to hide expander control [+] and prevent user drill down with keyboard?

Rajadurai C [Syncfusion]
Replied On November 23, 2009 02:35 AM

Hi Sergey,

Thanks for your interest in Syncfusion Products.

To prevent the nested table from getting shown by expanding the parent record, two things have to be followed in application.
1) ShowTableIndent property must be set to false.

this.gridGroupingControl1.TableOptions.ShowTableIndent = false;

2) RecordExpanding event have to handled to prevent the nested table droppingdown while expanding through keyboard.

this.gridGroupingControl1.RecordExpanding += new Syncfusion.Grouping.RecordEventHandler(gridGroupingControl1_RecordExpanding);

void gridGroupingControl1_RecordExpanding(object sender, Syncfusion.Grouping.RecordEventArgs e)
{
e.Cancel = true;
}

Here is a sample for your reference in which this has been implemented.
http://help.syncfusion.com/support/samples/Grid.Windows/7.4.0.20/F91503.zip

Regards,
Rajadurai

Sergey Merkuriev
Replied On November 30, 2009 12:57 PM

Thank you. That works. But I've got another problem with row selection. See attached picture.

Here is code which I use for row selection:

private void OnPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
Record record = this.GridControl.Table.CurrentRecord;
object dataItem = GetDataItem(record == null ? (object)null : record.GetData());

GridCurrentCell cc = this.GridControl.TableControl.CurrentCell;
GridControlBase grid = this.GridControl.TableControl.CurrentCell.Grid;

if (dataItem != null && e.Inner.RowIndex > grid.Model.Rows.HeaderCount &&
e.Inner.ColIndex > grid.Model.Cols.HeaderCount && cc.HasCurrentCellAt(e.Inner.RowIndex))
{
if (e.Inner.ColIndex == cc.ColIndex)
{
if (cc.IsEditing)
{
e.Inner.Style.Interior = new Syncfusion.Drawing.BrushInfo(SystemColors.Window);
}
else
{
e.Inner.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.RoyalBlue);
}
}
else
{
if (e.Inner.Style.Interior.BackColor == GridControl.BackColor)
{
e.Inner.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.CornflowerBlue);
}
else
{
int resultColor = AlphaBlendRGB(e.Inner.Style.Interior.BackColor.ToArgb(),
Color.CornflowerBlue.ToArgb(), 153);
e.Inner.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(resultColor));
}
}

e.Inner.Style.TextColor = cc.IsEditing ? SystemColors.WindowText : SystemColors.HighlightText;
e.Inner.Style.Font.Bold = cc.IsEditing ? false : true;
}
}

private static int AlphaBlendRGB(int src, int bg, byte alpha)
{
uint rb = (uint)((((src & 0x00ff00ff) * alpha) + ((bg & 0x00ff00ff) * (0xff - alpha))) & 0xff00ff00);
uint g = (uint)((((src & 0x0000ff00) * alpha) + ((bg & 0x0000ff00) * (0xff - alpha))) & 0x00ff0000);
return (int)((src & 0xff000000) | ((rb | g) >> 8) + 0x00010101);
}



Selector_ca1b5695.rar

Sergey Merkuriev
Replied On November 30, 2009 02:23 PM

I forgot to say:

1. That problem, I mentioned before, happen only with records which has option to drill down.
2. Rows/record selection I have made according to example "Focused Selection" from "Syncfusion\EssentialStudio\6.4.0.15\Windows\Grid.Grouping.Windows\Samples\2.0\Selections\MultipleRecordSelection\"
If you will bound to that example collection of objects like I mentioned first post then you will get same problem.

Sergey Merkuriev
Replied On November 30, 2009 02:57 PM

Problem solved with using condition "e.Inner.Style.CellType != "Static""

Example:

if (dataItem != null && e.Inner.RowIndex > grid.Model.Rows.HeaderCount &&
e.Inner.Style.CellType != "Static" &&
e.Inner.ColIndex > grid.Model.Cols.HeaderCount && cc.HasCurrentCellAt(e.Inner.RowIndex))


I think you need update your examples too.

Jisha Joy [Syncfusion]
Replied On December 1, 2009 01:36 AM

Hi Sergey,

Thank you for your update. Glad to hear that issue has been resolved.

Regards,
Jisha

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;