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?
I'm glad you managed to solve your issue.
Don't hesitate to ask if you have other questions or concerns.
Thanks.
Putting it together, I embedded CR and Newline characters, and used:
function grid_Initialize(sender, eventArgs) { for (i = 0; i < sender.get_columns().get_length(); i++) { sender.get_columns().get_column(i)._htmlEncode = true; sender.get_columns().get_column(i)._enableMultiline = true; } }
Hi,
I would suggest you to modify your code like this:
for (i=0; i < sender.get_columns().get_length(); i++) ...
Let me know if you have any other questions.
That's getting closer. How do I iterate through an unknown number of columns?
This hasn't worked (ineffective, doesn't actually get the column)
for (col in sender.get_columns()) { col._htmlEncode = false; }
nor (count() is undefined):
for (i = 0; i < sender.get_columns().count(); i++ ) { sender.get_columns.get_column(i)._htmlEncode = false; }
You can set the HtmlEncode property of a column on Initialize client-side event:
grid.get_columns().get_column(1)._htmlEncode = false;