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.

How to allow 1 column to edit while keeping other columns readonly State?

Thread ID:

Created:

Updated:

Platform:

Replies:

117997 Jan 19,2015 08:27 AM Jan 22,2015 10:37 PM Windows Forms 6
loading
Tags: GridGroupingControl
Yujin Wu
Asked On January 19, 2015 08:27 AM

Hi Team,
 
I want to Edit 1 column in the GridGroupingControl, I want to operate like this:
 
1. 1  special column can be edited;
2. We can get how many rows are modified(the row Indexes ,or modified row data as List<T>);
3. if I use the code: "gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Cell;", the background-color of the selected rows is Black, how to set the bg-color to blue or yellow?
 
Could you help realize above features?
 
attach is my code, could you review my code and give suggestions?
 
Thanks,
Yujing
 

Attachment: EditColumnInGridGroupingControl_dffe3ec4.rar

Yujin Wu
Replied On January 19, 2015 08:32 AM

Hi Team,
 
Please use my new-uploaded project. thanks.

Attachment: EditColumnInGridGroupingControl_89af4674.rar

Muthukumar Kalyanasundaram [Syncfusion]
Replied On January 20, 2015 12:53 PM

Hi Yujing,

 

Thank you for your interest in Syncfusion products.

 

 

Query 1

1  special column can be edited

 

 

If you want to edit a column in a grid, you can use “AllowEdit” property as true. Please refer the below code,

 

Code:

gridGroupingControl1.TableDescriptor.AllowEdit = true;            gridGroupingControl1.Table.TableDescriptor.Columns[0].ReadOnly = true;            gridGroupingControl1.Table.TableDescriptor.Columns[1].ReadOnly = false;

gridGroupingControl1.Table.TableDescriptor.Columns[2].ReadOnly = true

 

 

Query 2

Modified data row index in a grid

 

 

If you want to modified data row index in a grid, you can use “TableControlCurrentCellEditingComplete”event. Please refer the below code,

 

Code:

this.gridGroupingControl1.TableControlCurrentCellEditingComplete += new GridTableControlEventHandler(gridGroupingControl1_TableControlCurrentCellEditingComplete);

void gridGroupingControl1_TableControlCurrentCellEditingComplete(object sender, GridTableControlEventArgs e)

{

GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;

MessageBox.Show("Row "+cc.RowIndex.ToString()+", Column" +cc.ColIndex.ToString());

}

 

 

Query 3

background-color of the selected rows in a grid

 

 

If you want to change the selected row back color in a grid, you can use “SelectionBackColor” property. Please refer the below code,

 

Code:

gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any | GridSelectionFlags.Row;

gridGroupingControl1.TableOptions.ListBoxSelectionCurrentCellOptions = GridListBoxSelectionCurrentCellOptions.MoveCurrentCellWithMouse;

gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One;

gridGroupingControl1.TableOptions.SelectionBackColor = Color.Yellow;

 

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K


Attachment: Edit_a_column_32669937.zip

Yujin Wu
Replied On January 20, 2015 09:48 PM

Hi Team,
 
Appreciated for your feedback, and it resoved back-color issue for the edited-row.
 
However, we want to clear any styles for the selected row after save the gird.
 
Please find the images in the VS project.
 
Waiting for your resolution...
 
Thanks,
Yujin

Attachment: Edit_a_column_ee0a8c58.rar

Muthukumar Kalyanasundaram [Syncfusion]
Replied On January 21, 2015 11:14 AM

Hi Yujin,

 

Thanks for the update.

 

If you want to clear the style of selected row after editing completed in a cell, you can use Selections.Clear() method. Please refer the below code,

 

Code:

private void button3_Click(object sender, EventArgs e)

{

this.gridGroupingControl1.TableControl.Selections.Clear();

this.gridGroupingControl1.Refresh();

}

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K


Attachment: Selection_Clear_93cfec3a.zip

Yujin Wu
Replied On January 22, 2015 05:32 AM

Hi Muthukumar ,
 
It resolved my issue, appreciated for your quickly-update.
 
Thanks,
Yujin

Muthukumar Kalyanasundaram [Syncfusion]
Replied On January 22, 2015 10:37 PM

Hi Yujin,

 

We are glad to hear that the reported issue has been resolved. Please let us know if you need any further assistance.

 

Regards,

Muthukumar K


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.

;