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

Formating text in Grid

Hi, I am using Syncfusion Grid Grouping Control - V 3.2.1.0 and i need to format text in the cell. I have reffered Syncfusion sample - Essential Grid Samples - Cell Types- Rich Text Cells. However this allows editing of the cell. How do we disable this? Thanks in advance.

3 Replies

AD Administrator Syncfusion Team June 27, 2006 04:26 PM UTC

Hi Deepa, Regarding the Question 1: Format the cells. The TextFormat browser sample shows you how to format the data in your grid. You can see the code that formats numbers and dates. It also has code that does the validation on the cell values as you leave the cell. Essential Grid uses the .Net Framework formatting support so that there is no additional learning curve involved. As a result of the .Net Framework, the formatting is culture sensitive. Here is a path. Essential Grid Samples - >Quick Start ->TextFormat. Syncfusion\Essential Studio\4.2.0.37\windows\Grid.Windows\Samples\Quick Start\TextFormat Regarding the Question 2: You need to handle the CurrentCellshowngDropDown event for cancelling the editing of the dropdown RichTextBox cell in a grid. Here is a code snippet. GridCurrentCell cc = this.gridControl1.CurrentCell; GridRichTextBoxCellRenderer cr = cc.Renderer as GridRichTextBoxCellRenderer; if( cr!= null) { foreach(Control c in cr.DropDownContainer.Controls) { if ( c is GridRichTextEntryPanel) { GridRichTextEntryPanel panel = c as GridRichTextEntryPanel; foreach(Control subc in panel.Controls) { if( subc is RichTextBox) { RichTextBox rich = subc as RichTextBox; rich.ReadOnly = true; } } } } } Let me know if this helps. Best Regards, Haneef


AD Administrator Syncfusion Team June 27, 2006 05:38 PM UTC

Hi, I want to use Rich Text Format. I want to format the text based on colors. Also i dont want the drop down button itself. Please refer to Syncfusion\Essential Studio\3.2.1.0\Windows\Grid.Windows\Samples\CellTypes\RichTextCells. Thanks >Hi Deepa, > >Regarding the Question 1: Format the cells. > >The TextFormat browser sample shows you how to format the data in your grid. You can see the code that formats numbers and dates. It also has code that does the validation on the cell values as you leave the cell. Essential Grid uses the .Net Framework formatting support so that there is no additional learning curve involved. As a result of the .Net Framework, the formatting is culture sensitive. > >Here is a path. >Essential Grid Samples - >Quick Start ->TextFormat. >Syncfusion\Essential Studio\4.2.0.37\windows\Grid.Windows\Samples\Quick Start\TextFormat > >Regarding the Question 2: > >You need to handle the CurrentCellshowngDropDown event for cancelling the editing of the dropdown RichTextBox cell in a grid. Here is a code snippet. > >GridCurrentCell cc = this.gridControl1.CurrentCell; >GridRichTextBoxCellRenderer cr = cc.Renderer as GridRichTextBoxCellRenderer; >if( cr!= null) >{ > foreach(Control c in cr.DropDownContainer.Controls) > { > if ( c is GridRichTextEntryPanel) > { > GridRichTextEntryPanel panel = c as GridRichTextEntryPanel; > foreach(Control subc in panel.Controls) > { > if( subc is RichTextBox) > { > RichTextBox rich = subc as RichTextBox; > rich.ReadOnly = true; > > } > } > } > } >} > >Let me know if this helps. >Best Regards, >Haneef


AD Administrator Syncfusion Team June 27, 2006 07:13 PM UTC

Hi Deepa, Regarding the drop down button: Try setting the ShowButtons property to GridShowButtons.Hide to hide the dropdown button in a cell. Here is a code snippet this.gridControl1.TableStyle.ShowButtons = GridShowButtons.Hide; Regarding the text formatting based on selection color: To format the text based on selection color of the RichText cell in a grid, you need to handle the PrepareViewStyleInfo event. Here is a code snippet. if(e.Style.CellType == "RichText" && e.Style.Tag == null) { RichTextBox rich = new RichTextBox(); this.gridControl1[e.RowIndex,e.ColIndex].Tag = true; rich.Rtf = e.Style.Text; for( int i = 0;i<=rich.TextLength;i++) { rich.SelectionStart = i; Color oldColor = rich.SelectionColor; for( int j= i;j
Loader.
Live Chat Icon For mobile
Up arrow icon