Hi All,
Is there a way to enable user to input MultiLine in a text field?
I tried TextBoxProvider and TextEditorProvider both seems not working.
When the user press "Enter" key, the field just exit edit mode but not go to the next line within the textbox.
Thanks!
David
davidwsk said:When the user press "Enter" key, the field just exit edit mode but not go to the next line within the textbox.
Hello David,
With the suggested manner above the user will be able to edit a cell and when the text of the cell reaches the end automatically the cursor is pushed to the next line and it is not needed the user to press enter. But if you want to do that on enter press or you want to implement custom logic and so on you can use provided by the grid client - side evnt handlers.
Please provide and example of how you would use the client side event handlers to allow the user to press the enter key to add a a new line to the text. Changing the textmode to Multiline just allows for WRAPPING, which is NOT the same as true multi-line editing. The fact that the editor doesn't support or allow true multi-line editing (with the user able to add multiple lines by hitting the enter key) is absurd. If you are going to propose a work around to your products gross limitations, please have the courtesy to provide an example of how you would implement such a work around for such a basic missing feature.
Praveena,
When running the page that you provided with the same version of the NetAdvantage assemblies that you reference I don't reproduce the issue. Let me know what web browser are you using and I will test again.
Let me know if you have any questions with this matter.
Hi,
We are using IE 8 and on Page load itself it getting that error. And in firefox and chrome there is no error but it is allowing more than max length i.e. more than 4 characters.
Please do the needful and I am waiting for your message.
Thanks in advance.
In IE8, the following updated WebDataGrid1_Initialize event handler will correct the issue:
function WebDataGrid1_Initialize(sender, eventArgs) { var editor = document.getElementById("SiteEditor"); editor.onkeydown = function (e) { if (e == null) e = event; // don't cancel the event if the backspace or delete key was pressed. if (e.keyCode == 8 || e.keyCode == 46) return true; // cancel the event if the length of the editor is 4 or more. if (editor.value.length >= 4) return false; };}
When I tested in Firefox and Chrome I was only able to enter up to four characters.
No it is not working, it is giving the error as "Microsoft JScript runtime error: 'null' is null or not an object" in the javascript on the page load itself i.e. on the first time run itself.
Can we able to do this in the "onkeypress" event. because when I tried this "onkeypress" in the TextBoxProvider. it is not accepting this event and it is giving the error.
Thanks.
When you are debugging this, what specifically is null?
Hello Praveen,
Please let me know if I can provide any further assistance regarding this matter.
To prevent the cell from existing edit mode when tab is pressed, Webdatagrid's KeyDown and cell exiting edit mode clients side events needs to be handled like below
function WebDataGrid1_Grid_KeyDown(sender, eventArgs) { var editedColumn = ""; if (sender.get_behaviors().get_editingCore().get_behaviors().get_cellEditing().get_cellInEditMode() != null ) { editedColumn = sender.get_behaviors().get_editingCore().get_behaviors().get_cellEditing().get_cellInEditMode().get_column().get_key(); } if (editedColumn == "Name") { if (eventArgs.get_browserEvent().keyCode == 9 || eventArgs.get_browserEvent().keyCode == 13) { eventArgs.set_cancel(true); }}} function WebDataGrid1_CellEditing_ExitingEditMode(sender, eventArgs) { if (eventArgs.getCell().get_column().get_key() == "Name") { if (eventArgs.get_browserEvent().keyCode == 9 || eventArgs.get_browserEvent().keyCode == 13) { eventArgs.set_cancel(true); }}}
{ var editedColumn = "";
if (sender.get_behaviors().get_editingCore().get_behaviors().get_cellEditing().get_cellInEditMode() != null ) {
editedColumn = sender.get_behaviors().get_editingCore().get_behaviors().get_cellEditing().get_cellInEditMode().get_column().get_key();
}
if (editedColumn == "Name") {
if (eventArgs.get_browserEvent().keyCode == 9 || eventArgs.get_browserEvent().keyCode == 13) {
eventArgs.set_cancel(true);
}}}
function WebDataGrid1_CellEditing_ExitingEditMode(sender, eventArgs)
{
if (eventArgs.getCell().get_column().get_key() == "Name") {
Attached sample demonstrates the same.
The have tried to cancel the event when the tab key is pressed but the cell is exiting from the editmode. So, I am currently discussing with our Development team regarding this matter and I will update you by the end of the day tomorrow with the progress.
Please let me know if you have any further questions regarding this matter
Like a multiline when the tab key is pressed inside the particular column cancel the event and it should work as a tab in the notepad.
Please do the needful.
Thanks in Advance.
Hello Praveena,
I would recommend you to use TextEditorProvider as shown below:
<EditorProviders> <ig:TextEditorProvider ID="WebDataGrid1_TextEditorProvider1"> <EditorControl ClientIDMode="Predictable" MaxLength="4" MultiLine-Rows="4" TextMode="MultiLine"> </EditorControl> </ig:TextEditorProvider> </EditorProviders>
This will limit number of character to 4, It is not needed to write any custom code.
I hope this helps.