Is there a way to turn on multi line for cell editing without using a template field?
In the older ultra web grid it was done like this:
this.UltraWebGrid1.Columns.FromKey("Description").CellMultiline = CellMultiline.Yes;
Is there something similar for a Web data grid?
Thanks
Hello,
Could you have a look at the following forum thread ;
http://forums.infragistics.com/forums/p/38263/220806.aspx#220806
Hope it helps.
No, this does not work. Basically we have a form that allows client side CRUD. In this form exists a multi-line text box that must update CR/LF to the database.
We update the database by first using javascript to update the cells in the datagrid. Once the cells are updated we send a post back. When we go from text box to datagrid cell, all CR/LF are lost and then not updated to the database.
I tried using the text editor and set it to multi-line as suggested, but the result is the same. Any other ideas on how to resolve this issue would be appreciated.
I am not sure I understand well your scenario but keep in mind that the grid is designed to do CRUD operations in automatic or manual manner. If you use the first approach the grid is bound to some of the supported datasoruces and once a row has been updated the grid try to commit the changes to the database. This scenario requires minimum effort from developer side. If you prefer to implement CRUD operation for yourself it means that you must take care for the changes to be persist into the database and for this scenario the grid exposes events like RowUpdating / ed to be handled. The easiest way would be to handle RowUpdating event and take the new data in it and update your db. When editor provider is used for example WebTextEditor actually one instance is render down to the client and when a given cell get into edit mode the editor shows up. Once the user done with the editing the editor becomes hidden and its value is set to the cell of the grid.
Hope this will help you.
Currently we have this setup
WebDataGrid -- bound to object data source
TextBox -- Multi-Line enabled, supports carriage return/ line feed
Button -- on button pressed javascript updates webdatagrid cells, then performes postback on datagrid that is inside an update pannel.
---------------------------------------------------
In javascript we have something like this:
selectedRow.get_cell(i).set_value(
$get(
'<%= wte_message.ClientID %>').value);
After cell updates, all carriage return/line feed are gone. We need the CR/LF.
I did try this:
function Button1_onclick() { var val = $get('<%=TextBox1.ClientID %>').value; var grid = $find('<%=WebDataGrid1.ClientID %>'); var row = grid.get_rows().get_row(0).get_cell(1).set_text(val); }
Attached to a button.
If the text is longer that the width of the cell it will be automatically transferred to next row in the grid cell.
Thanks.
Rado,
Thanks for your reply. While the above does work, and do what you say, it does not work 100% for our situation.
We are using the CR/LF to parse and split strings. A user may enter the following text:
Click It
Or
Ticket
While the data grid would show the following:
Click It Or
This is an issue the datagrid does not support a true CR/LF, if you examine the text it actually is one single line, just word wrapped. Why does the datagrid not support a CR/LF?
Can I replace the CR/LF ( or char(13) or "\n") into something compatible with your datagrid?
function Button1_onclick() { var val = $get('<%=TextBox1.ClientID %>').value; val = val.replace(/\n/g, "working CR/LF"); var grid = $find('<%=WebDataGrid1.ClientID %>'); var row = grid.get_rows().get_row(0).get_cell(1).set_text(val); }
thanks
We used a replace in the SQL select with Replace(fieldname,char(13),'<BR>) as fieldnamewhich makes it display fine, but then if you edit the line, you will get a code injection message when it posts.Ug