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. Image for the cookie policy date

GridDataBoundGrid + Hirachie View

Hi, I would like to achieve that the parent record only displays the plus, when a child record is available in a relation. This is the "normal" behavior after you have clicked a record with no child record. Is there a way to handle it programatically/automatically? (I've more then 100.000 records in the grid...) img1.gif shows the records after binding. img2.gif shows the goal, after manually selecting any record... Thanks in advance, Georg

2 Replies

AD Administrator Syncfusion Team November 10, 2003 10:53 AM

> Hi, > > I would like to achieve that the parent record only displays the plus, when a child record is available in a relation. > > This is the "normal" behavior after you have clicked a record with no child record. > > Is there a way to handle it programatically/automatically? (I've more then 100.000 records in the grid...) > > img1.gif shows the records after binding. > img2.gif shows the goal, after manually selecting any record... > > Thanks in advance, > > Georg Here is a sample that initially shows a - if a row has no children. It does so by handling the DrawCell event and drawing the cell there using the right bitmaps. There is a little helper routine that checks if the row has children. Instead of changing it to a - sign, you could make it a blank if that is what you need. You can change the DrawCell code to start out
if(e.ColIndex == 1 && e.RowIndex > grid.Model.Cols.HeaderCount)
{
	bool noChildren = !HasChildrenAtRow(e.RowIndex);
	if( noChildren)
	{
		e.Cancel = true;
		Syncfusion.Drawing.BrushPaint.FillRectangle(e.Graphics, e.Bounds, grid.GetInterior(e.Style.Interior));
		return;
	}
	object o = e.Style.CellValue;
	if(o.Equals(-1) || o.Equals("") ||
		(!grid.IsExpandedAtRowIndex(e.RowIndex)  && noChildren )) 
			o = (int)1;
//......


GS Georg Schmidt November 11, 2003 12:28 AM

Thank you for your fast help. Georg

Loader.
Live Chat Icon For mobile
Up arrow icon