Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
504
MultiLine grid contents, runtime-generated grid
posted

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?

Parents
No Data
Reply
  • 37874
    posted

    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.

     

Children