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

StyleInfo.PasswordChar only masks the password text, users can still copy-paste to notepad and see the actual password

Hi there, I am using SyncFusion Grid v2.0.5.1. I do Syncfusion.Windows.Forms.Grid.GridBoundColumn.StyleInfo.PasswordChar = ''*''; to make my password column masked with * character. This acheives the purpose of hiding the password. But if a user copy-pastes the field in notepad, the actual unmasked password is naked for him. This is reported a severe bug in my software. Please let me know how can I protect the password fields in SyncFusion grid. Please note that I am encrypting passwords before saving to persistent storage. Regards, Salil

4 Replies

AD Administrator Syncfusion Team June 29, 2005 10:04 AM UTC

One way you can handle this is to subscribe to the grid.Model.ClipboardCanCopy event, and do not allow the copy if the selections intersect your password column.
this.gridDataBoundGrid1.Model.ClipboardCanCopy += new GridCutPasteEventHandler(Model_ClipboardCanCopy);

private void Model_ClipboardCanCopy(object sender, GridCutPasteEventArgs e)
	int colIndex = this.gridDataBoundGrid1.Binder.NameToColIndex("passwordCOL");
		e.Handled = true;
		e.Result = false;


RE resmi March 16, 2006 12:30 PM UTC

hi Can u solve this in GGC Thanks

AD Administrator Syncfusion Team March 16, 2006 03:29 PM UTC

Hi, Please refer to the code snippet below, that demonstrates this functionality for the GGC. Let us know if you need more information on this. //this.gridGroupingControl1.TableControl.Model.ClipboardCanCopy += new GridCutPasteEventHandler(Model_ClipboardCanCopy); void Model_ClipboardCanCopy(object sender, GridCutPasteEventArgs e) { int col = this.gridGroupingControl1.TableModel.NameToColIndex("PasswordCol"); GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell; GridRangeInfo range = this.gridGroupingControl1.TableModel.Selections.Ranges.ActiveRange; // a range of cells if(range == GridRangeInfo.Empty) this.gridGroupingControl1.TableModel.Selections.Ranges.Add(GridRangeInfo.Cell(cc.RowIndex,cc.ColIndex)); // single cell if (this.gridGroupingControl1.TableModel.Selections.Ranges.AnyRangeIntersects(GridRangeInfo.Col(col))) { e.Handled = true; e.Result = false; } } Thanks for choosing Syncfusion Products. Best regards, Madhan.

RE resmi March 17, 2006 04:49 AM UTC

thanks its working

Live Chat Icon For mobile
Up arrow icon