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

How to check the the row belongs to nested table

Hi, I am using this.groupingGridControl.TableControl.ScrollTipFeedback += new ScrollTipFeedbackEventHandler(TableControl_ScrollTipFeedback); event. private void TableControl_ScrollTipFeedback(object sender, ScrollTipFeedbackEventArgs e) { Element el = this.ggdAssetView.SyncfusionGridControl.Table.NestedDisplayElements.GetItemAtYAmount(e.Value); if(el is GridRecordRow) { if (this.ggdAssetView.SyncfusionGridControl.TableDescriptor.Fields.IndexOf(DBColumns.AssetName) > -1) { e.Text = ((GridRecordRow)el).ParentRecord.GetValue(DBColumns.AssetName).ToString(); e.Location = new Point(700, 400); e.Size = new System.Drawing.Size(300, 15); } } } Here I am trying set tool tip text. It to set e.text even when it is a row from a nested table.There it gives "Object reference not set an instance". So I want to a make a check if it is a nested table row..it should still be displaying from the parent table column text. Thanks, Prathima

6 Replies

AD Administrator Syncfusion Team September 2, 2005 08:53 AM UTC

Here is a little sample that shows values from the "Name" column in the 2 inner most tables when their records is at the top. It does so without getting exceptions by using the underlying data object to retrieve the values. http://www.syncfusion.com/Support/user/uploads/GGC_ScrollTips_dd1d3650.zip When the display element at the top is not a record with a "Name" field, it shows the default display values for that particular kind of display element. What different behavior do you want?


PV prathima venkobachar September 2, 2005 10:35 AM UTC

Example is very nice !! It works fine. It would be nice when it scrolls through nested table it display only "ParentID=1" insted of "Category: [ChildTable] 1-Items parentID=1" Can we do this..? Thanks, Prathima


AD Administrator Syncfusion Team September 2, 2005 03:17 PM UTC

You can hack it using the code below. Or, if you have our source code, you can dig through OnScrollTipFeedback in \Windows\Grid.Grouping.Windows\Src\Controls\GridTableControl.cs to see how it prepares that string.
private void TableControl_ScrollTipFeedback(object sender, Syncfusion.Windows.Forms.ScrollTipFeedbackEventArgs e)
{
	int i = e.Text.IndexOf("Items");
	if(i > -1 && e.Text.StartsWith("Category") )
	{
			
		e.Text = e.Text.Substring(i + 6);
		e.Size = new Size(200, 20);
	}
	else
		e.Text = " AddNewRow ";

	Element el = this.gridGroupingControl1.Table.NestedDisplayElements.GetItemAtYAmount(e.Value);
	if(el is GridRecordRow) 
	{
		DataRowView drv = el.GetData() as DataRowView;
		if (drv != null && drv.Row.Table.Columns.IndexOf("Name") > -1) 
		{
			e.Text = drv["Name"].ToString();
			e.Size = new Size(200, 20);
		}
	}
}


PV prathima venkobachar September 6, 2005 05:09 AM UTC

Thanks for the reply. I don''t have grid.grouping.Windows. If I don''t want to show scroll tool tips at all in case of nested table and when there is a grouping..how can I do it..? I tried with e.cancel = true.But it doesn''t seems like working. Thanks, Prathima


AD Administrator Syncfusion Team September 6, 2005 07:41 AM UTC

To not show the sceolltips when grouped, you can unsubscribe to the event when the grid is grouped, and resubscribe when the grid is no longer grouped. The simplest thing to do to hide individual scrolltips, but keep others, would be to set the size to empty. e.Size = Size.Empty;


PV prathima venkobachar September 6, 2005 08:27 AM UTC

Good Idea.Thanks a lot !!

Loader.
Live Chat Icon For mobile
Up arrow icon