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

PasswordChar Property of Text in a DataGrid

Hi to everyone... I'm just been battered by this situation. The case goes like this.. I have set a Bound DataGrid Table for System Access. But then as I display the Records, namely, {Name, Password, DateAccessed..}, the datagrid reflects the actual string password value of the Password field which should be in a passwordchar mode. It should be hidden in a Passwordchar Property of a text Object right? Is there any possible solution on how to use and trigger the PasswordChar Property of a certain field to a Datagrid... Thanks for reading.. I hope to receive any Reply from you people...

1 Reply

AD Administrator Syncfusion Team November 8, 2002 08:13 AM UTC

Essential Grid does not use the TextBox control as the basis for its TextBox cell, instead it uses the RichTextBox control which does not have a PassWord property. In a future release, we will be adding many additional celltypes, including a celltype that uses the Windows Forms textbox, and thus has a password property. If you just want to handle the display if the password, and not allow in-cell editing of the password, then you can handle the PrepareViewStyleInfo event and handle things there. If you do not set the Static celltype, then the cell will be editable, but it would show the old password when you start the edit. There are ways around this as well, but it would take more work.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
	//password column
	if(e.RowIndex > 0 && e.ColIndex == 2 && e.Style.Text.Length > 0)
	{
		string s = new String('*', e.Style.Text.Length);
		e.Style.Text = s;
		e.Style.CellType = "Static";
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon