0

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
4
  • Are you using ASP.NET? It's also not clear what you're trying to do. What have you tried? Commented Dec 3, 2012 at 14:16
  • Heads up - I removed the SQL tag, since your code is strictly C#. Consider changing title. Commented Dec 3, 2012 at 14:18
  • 1
    Convert it to an array of strings by calling String.Split() and manipulating from there? Use String.replace to replace " - " with html BR tags? What have you tried so far? Commented Dec 3, 2012 at 14:18
  • Its a Web Application in C# ASP.NET Commented Dec 3, 2012 at 14:18

1 Answer 1

1

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>") %>
    
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.