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.
Syncfusion Feedback

how to allow user to select only parent record

Thread ID:

Created:

Updated:

Platform:

Replies:

55826 Feb 5,2007 09:03 PM UTC Feb 16,2007 09:19 PM UTC WinForms 9
loading
Tags: Grouping
Geetha Krishnamurthy
Asked On February 5, 2007 09:03 PM UTC

how to allow user to select only parent record and not select child records

Administrator [Syncfusion]
Replied On February 6, 2007 05:26 PM UTC

Hi Gkrish,

One way you can do this by handling the SelectedRecordChnaging event of the grid and set e.Cancel to true for inner most child table(child records). Here is a code snippet.

this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
this.gridGroupingControl1.SelectedRecordsChanging +=new SelectedRecordsChangedEventHandler(gridGroupingControl1_SelectedRecordsChanging);

private void gridGroupingControl1_SelectedRecordsChanging(object sender, SelectedRecordsChangedEventArgs e)
{
if( e.Action == SelectedRecordsChangedType.Added )
{
if( e.SelectedRecord != null && e.SelectedRecord.Record.NestedTables.Count == 0 )
e.Cancel = true;
}
}

Please refer to the attached sample for implementation.
Excel Export.zip

Best Regards,
Haneef

Geetha Krishnamurthy
Replied On February 7, 2007 10:30 PM UTC

thank you

Geetha Krishnamurthy
Replied On February 8, 2007 03:24 PM UTC

this one doesnt work like explained or expected.. the code snippet has no effect...

Administrator [Syncfusion]
Replied On February 9, 2007 01:47 AM UTC

Hi Gkrish,

We were not able to reproduce the issue here. Is it possible for you to upload us a sample or modify the attached samples to reproduce the issue here? This will help us to analyse the issue further.

Here is a sample.
Excel Export.zip

Best regards,
Haneef

gkrish
Replied On February 9, 2007 04:17 PM UTC

attached is the sample...

Excel Export_1872b9530.zip

Geetha Krishnamurthy
Replied On February 15, 2007 06:55 PM UTC

I have attached a sample in my previous posting where you can it doesnt work as expected. Kindly look into it and let me know what is the problem.

thank you

Administrator [Syncfusion]
Replied On February 15, 2007 11:15 PM UTC

Hi Gkrish,

The reason for getting this problem is that you are enabled the cell based ( derived from GridControlBase) selection type in a grouping grid. You can turn of the cell based selection using TableOptions.AllowSelection property to None. Andthen enable the record based selection in a grid using ListBoxSelectionMode property. Here is a code snippet.

this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None;
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
this.gridGroupingControl1.SelectedRecordsChanging +=new Syncfusion.Grouping.SelectedRecordsChangedEventHandler(gridGroupingControl1_SelectedRecordsChanging);
this.gridGroupingControl1.Table.ExpandAllRecords();

Here is a modified sample.
modifiedExcel Export.zip

Here is KB article that discuss about the groupgrid selection selection types.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=344

Best regards,
Haneef

Geetha Krishnamurthy
Replied On February 16, 2007 04:01 PM UTC

if i dont set allowselection to row, i will not be able to hit delete key placing the selction on a parent record. Rather if I hit delete it does nothing. if i do set to allowselection to row, it deletes that row from the grid and associated dataset. So i think I will need that to remain row or please let me know if there is another way i can hit delete to delete row...

Administrator [Syncfusion]
Replied On February 16, 2007 09:19 PM UTC

Hi Gkrish,

Please refer to the forum thread and let me know if this helps.
http://www.syncfusion.com/support/forums/message.aspx?&MessageID=45230

Best regards,
Haneef

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.

Warning Icon 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.Close Icon

;