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 have different context menus attached to parent grid and chid grid

Hi ,

I am looking into how to provide different context menus on the parent grid and the child grid.Can you please point me on how this can be done and whether there is any sample code that i can look into.

Can you please advise.

thanks
-Gurtaran


5 Replies

RP Rekha P Syncfusion Team February 18, 2009 01:38 PM UTC

Hi Gurtaran,

Thank you for your interest in Syncfusion Products.

We regret to let you know that we do not provide support to show different context menus for parent table and child table. As a workaround, you can check and iterate through table row ids and enable the context menu.

http://websamples.syncfusion.com/samples/Grid.Web/7.1.0.21/F79617/ContextMenu_Sample.zip

Please let us know if you have any concerns.

Thanks,
Rekha



AD Administrator Syncfusion Team February 18, 2009 03:12 PM UTC

Thanks Rekha,

I'll try this one.
another question that i had was how in general i can have my events apply to child grids also.Say eg if i want the selected records changed event to work for child grids also.
Can you please advise on this too.

Thanks
-Gurtaran

>Hi Gurtaran,

Thank you for your interest in Syncfusion Products.

We regret to let you know that we do not provide support to show different context menus for parent table and child table. As a workaround, you can check and iterate through table row ids and enable the context menu.

http://websamples.syncfusion.com/samples/Grid.Web/7.1.0.21/F79617/ContextMenu_Sample.zip

Please let us know if you have any concerns.

Thanks,
Rekha





RP Rekha P Syncfusion Team February 20, 2009 03:32 AM UTC

Hi Gurtaran,

Please refer the Code snippet below to trigger SelectedRecordsChanged event for child tables.

[C#]


GridRelationDescriptor parentToChildRelationDescriptor;

protected void Page_Load(object sender, EventArgs e)
{
if (! IsPostBack)
{
// Manually specify relations in grouping engine. The DataSet does not need to have any DataRelations.
// This is the same approach that should be used if you want to set up relation ships
// between independent IList.
parentToChildRelationDescriptor = new GridRelationDescriptor(); //Child Table
parentToChildRelationDescriptor.ChildTableName = "MyChildTable"; // same as SourceListSetEntry.Name for childTable (see below)
parentToChildRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails;
parentToChildRelationDescriptor.RelationKeys.Add("parentID", "ParentID");
}
parentToChildRelationDescriptor.ChildTableDescriptor.SelectedRecordsChanged += new SelectedRecordsChangedEventHandler(ChildTableDescriptor_SelectedRecordsChanged);
}

void ChildTableDescriptor_SelectedRecordsChanged(object sender, SelectedRecordsChangedEventArgs e)
{
//your code
}



Please let me know this code snippet helps you.

Thanks,
Rekha





AD Administrator Syncfusion Team February 24, 2009 06:34 PM UTC

Hi Rekha,

Many thanks for the above.
On my first question - I am still a bit confused on the workaround that i can use to get this different context menu working.Can you please elaborate on this , or probably can you please post some code as part of reply to this( as i was not sure which part of the sample code i could use in the sample that you pointed previously )


Thanks again.
Gurtaran


>Hi ,

I am looking into how to provide different context menus on the parent grid and the child grid.Can you please point me on how this can be done and whether there is any sample code that i can look into.

Can you please advise.

thanks
-Gurtaran





RP Rekha P Syncfusion Team February 25, 2009 01:48 PM UTC

Hi Gurtaran,

We regret to let you know that it is not possible to show different context menus for parent table and child table. Because the ContextMenu is designed to show for a GridGroupingControl parent table id and also the child table ids are generated dynamically with random numbers, hence we cannot able to show different context menus for parent table and child table.

We regret for the inconvenienced caused and please let us know if you have any concerns.

Thanks,
Rekha


Loader.
Live Chat Icon For mobile
Up arrow icon