Sinoy Devassy
Sinoy Devassy

Reputation: 574

devexpress GridViewDataColumn multiline

I have used devexpress Gridview in my asp.net application. I need to show one of the cell data as multiline, like :-

abcdefghijk
abcdefghijk
abcdefghijk

I have tried to use the EncodeHtml="false" method but it doesn't worked.

Please suggest a good option to do this.

Upvotes: 0

Views: 418

Answers (1)

Beldi Anouar
Beldi Anouar

Reputation: 2180

I propose :

-To separate your data with comma as :abcdefghijk,abcdefghijk,abcdefghijk - Handle the HtmlDataCellPrepared event .

protected void ASPxGridViewInstance_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e) 
    {
        if (e.DataColumn.FieldName == FieldNameHere) 
        {
          if  (e.CellValue != null)
          {
                    string[] stringValues = e.CellValue.ToString().Split(',');
                    foreach (string item in stringValues)
                        e.Cell.Text += item + "<br />";
            }
        }
    }

Upvotes: 1

Related Questions