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
close icon

How to use tab key in the cell value

I want to have tab indentation for the text in the cell. The grid doesn't seem to indent the text properly unless I am in edit mode of the cell. Any help?

1 Reply

AD Administrator Syncfusion Team October 21, 2003 02:13 PM UTC

There is no support in the grid to handle this, so you would have to implement it yourself. There are several ways to try to do it. You could derive your own textbox cell control, and handle the static drawing by swapping out the tabs for spaces for you draw the string. Or if this is sufficient, a simpler technique would be to handle PrepareViewStyleInfo and swap out the tabs there.
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.RowIndex != e.RowIndex || cc.ColIndex != e.ColIndex
		|| !cc.IsEditing)
	{
		string s = e.Style.Text;  
		s = s.Replace("\t", "            ");
		e.Style.Text = s; 
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon