v11.1, dotnet v4.
I have a webDataGrid with AutoGenerateColumns. (At runtime I bind it to the results of a crosstab query.)
I want to set most, or optionally all, columns to recognise a newline. I can provide the newline in the data either as CR+LF or as <br/>, but have been unable to figure out how to set EnableMultiLine and/or HtmlEncode.
I'd prefer to do it server-side, immediately after .DataBind(), but would accept a client-side solution. How?
oops, no, that doesn't work.
Got it.. Right after DataBind, iterate the columns.
wdg1.DataBind(); foreach (Infragistics.Web.UI.GridControls.BoundDataField col in wdg1.Columns){ col.EnableMultiline=true; }
Thanks for the suggestion.
This is display-only, there's no CRUD.
My question is: How do I set HtmlEncode to false on the columns? The columns don't exist at design time.
Hello,
I would suggest you to set HtmlEncode to false for the required columns. Then you should handle manually the RowUpdating event. From the event arguments you can get the values from the row being updated. If there is a tag in some of the values, it would be represented like "\r\n" sequence in e.Values collection. So you should replace this with and use the new string to directly update the database. Also, you should set AutoCRUD=”false” for the EditingCore behavior and set e.Cancel = true to cancel the default update in RowUpdating event handler.
If you have any questions, please don’t hesitate to ask.