Shaggy
Shaggy

Reputation: 5800

Split SQL Column to Multiple Rows in HTML Table in C#

Lets say my datatable retrieves column with value "SAGAR - SAGAR"

DataTable dtOutput;
dtOutput = Generix.getATMDetails(sATM);//Retrieves data

I can convert my datatable to HTML Table for display in HTML Page. How can i convert one of its Column into multi line format while displaying it in HTML Page

E.g: dtOutput (data)

Comments (Column Header)
SAGAR - SAGAR - SAGAR

now while displaying it in HTML page it should be like this

SAGAR
SAGAR
SAGAR

Upvotes: 0

Views: 925

Answers (1)

Kaf
Kaf

Reputation: 33839

You can get a new line by adding </ br>. There are several ways to do this.

  • from the select query using REPLACE(comments, ' - ' , '</ br>') (if you are in sql server)
  • within the datatable
  • during the data binding as follows

    <%# Eval("comments").ToString().Replace(" - ","</ br>") %>
    

Upvotes: 1

Related Questions