User editable derived CellModel

i see the example in the samples for the GridLinkLable but none of the samples allow user editing If i have created a derived control (for example, i have an UpperCaseTextBox control which is a control that derives from Textbox and catched the keypress events and forces uppercase) can i use that as the grid cell ??

3 Replies

ST stanleyj Syncfusion Team December 5, 2005 07:36 AM UTC

Hi Adam, Refer the sample in windows\Grid.Windows\Samples\In Depth\CellButtons that we ship. When you derive the GridTextBoxCellModel and the GridTextBoxCellRenderer your cell will behave as a TextBox Control. In the LinkLabelCells sample, the LinlLabelCell is derived from the GridStaticCellModel and the GridStaticCellRenderer which implements a static CellType. You cold try OriginalTextBox as CellType instead of deriving private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { if(e.RowIndex > 0 && e.ColIndex > 0) { e.Style.CellType = "OriginalTextBox"; e.Style.CharacterCasing = CharacterCasing.Upper; } } Let me know if this helps. Best regards, Stanley


AK Adam K. December 5, 2005 04:46 PM UTC

i am trying to do this generically so other people can use my celltype. Because of this i dont want to do the coding in the querycell event handlers. I want to create an isolated new CellType that i can have other use without having to code up their own event handlers . . >Hi Adam, > >Refer the sample in windows\Grid.Windows\Samples\In Depth\CellButtons that we ship. When you derive the GridTextBoxCellModel and the GridTextBoxCellRenderer your cell will behave as a TextBox Control. In the LinkLabelCells sample, the LinlLabelCell is derived from the GridStaticCellModel and the GridStaticCellRenderer which implements a static CellType. > > > >You cold try OriginalTextBox as CellType instead of deriving > > private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) > { > if(e.RowIndex > 0 && e.ColIndex > 0) > { > e.Style.CellType = "OriginalTextBox"; > e.Style.CharacterCasing = CharacterCasing.Upper; > } > } > > >Let me know if this helps. > >Best regards, >Stanley


AD Administrator Syncfusion Team December 5, 2005 07:22 PM UTC

You can try creating a custom celltype to use your control. It will likely take some coding depending upone the exact functionality you want. Take a look at the Windows\Grid.Windows\Samples\CellTypes\Calendar sample. It shows teh steps needed to derive a custom scell type that wraps a MonthCalendar control. You coul dtry to do something similar with your control. Do a search for CellModels.Add in the Syncfusion\Essential Studio\3.3.0.0\Windows\Grid.Windows\Samples folder. It will show 18 or so different custom cell types that do various things if you need other samples. There is also a discusion of deriving cutom cellstyles in the User Guide that uses the LinkLabel cells as the basis for the discussion.

Loader.
Up arrow icon