I am trying to limit the length of text entry fields in a simple webdatagrid. I have tried using a texteditorprovider.
nameEditor = New TextEditorProvider() nameEditor.EditorControl.ID = "Name" nameEditor.EditorControl.MaxLength = 10
Dim editColumn2 As EditingColumnSetting editColumn2 = New EditingColumnSetting() editColumn2.ColumnKey = "NatureofRisk" editColumn2.EditorID = "Name" wdgTable.Behaviors.EditingCore.Behaviors.CellEditing.ColumnSettings.Add(editColumn2)
This works but the textbox is not lined up with the column the TextEditorProvider relates to so there is no sense of editing the grid.
Also when clicking off the editor it seems to move to the top of the grid.
When applying this to the RowAdding behaviour the cell being edited appears below the add row.
Is there a way to implement this feature? It's a very obvious thing to do to limit the input text to match the databae column sizes.
Thanks in advance,
Andy
Hello JJB,
Thank you for contacting Infragistics!
I am looking into the details you have provided. And, I will be updating you on or before Friday.
If you have any questions, please let me know as well
We may have to define the TextEditorProvider at design time. And reference the TextEditorProvider on the serverside after the columns are created.
For more information, please refer to the attached sample.
If you have any questions, please let me know as well.
I am just following up and see if you need further assistance.
Was there ever a resolution to this? If I create the TextEditorProvider at run-time, the MaxLength property does not work, but the textbox at least lines up correctly. However, if I create the TextEditor at design time, the MaxLength rule works, but the textbox appears all the way to the left when I click on the appropriate field, then moves to the top left corner when I click off the field. Please advise. Thank you.
The issue was I was setting the wrong ID when creating the provider. I needed to set <ig:TextEditorProvider ID="ShortDescription"> and use that in the code-behind.
<EditorProviders> <ig:TextEditorProvider ID="ShortDescription"> <EditorControl ID="ShortDescriptionA" MaxLength="9"> </EditorControl> </ig:TextEditorProvider> </EditorProviders>