[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

escape characters won't work why?

Posted on 2006-06-24
9
Medium Priority
?
236 Views
Last Modified: 2009-12-16
This should produce a nice table, but it does not work. It looks like escape characters not work. I print the text in an asp label.


private string GetTableData(DataTable dt)
    {

        StringBuilder TableData = new StringBuilder();
        // retrieve header row column labels
        TableData.AppendFormat("Row");
        foreach (DataColumn dc in dt.Columns)
        {
            TableData.AppendFormat("/t{0}", dc.ColumnName);
            TableData.AppendFormat("/t");
        }

        // retrieve rows
        int j = -1;
        foreach (DataRow dr in dt.Rows)
        {
            TableData.AppendFormat("[{0}]", ++j);
            foreach (DataColumn dc in dt.Columns)
            {
                TableData.AppendFormat("/t{0}", dr[dc]);
            }
            TableData.AppendFormat("/n");
        }

        return TableData.ToString();
    }
0
Comment
Question by:m-jansen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 5

Expert Comment

by:AdGroot
ID: 16976421
use the \ in place of the /

Change /t  to \t
and /n to \n

Ad
0
 

Author Comment

by:m-jansen
ID: 16976427
sorry that does not work either
0
 
LVL 5

Expert Comment

by:AdGroot
ID: 16976442
Strange

I try this

            StringBuilder TableData = new StringBuilder();
            TableData.AppendFormat("AA\tKK\tBB");
            TableData.AppendFormat("\n");
            TableData.AppendFormat("AAB\tBBK\tKK");
            Debug.WriteLine(TableData.ToString());

with gives me as result

AA      KK      BB
AAB      BBK      KK
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:m-jansen
ID: 16976460
With this code
        StringBuilder TableData = new StringBuilder();
        TableData.AppendFormat("AA\tKK\tBB");
        TableData.AppendFormat("\n");
        TableData.AppendFormat("AAB\tBBK\tKK");
        lblTest.Text = TableData.ToString(); //asp lable
I get just this is the output.

AA KK BB AAB BBK KK

Debug.WriteLine(TableData.ToString()); does not work in my asp.net 2.0 website in VS
0
 
LVL 5

Assisted Solution

by:AdGroot
AdGroot earned 200 total points
ID: 16976469
A supose the asp label have some problems with the tabs

you can try this

           TableData.AppendFormat("/t{0,10}", dc.ColumnName);

Ad

0
 
LVL 5

Expert Comment

by:AdGroot
ID: 16976475
For left align try

           TableData.AppendFormat("/t{0,-10}", dc.ColumnName);

Ad

0
 
LVL 5

Accepted Solution

by:
AdGroot earned 200 total points
ID: 16976491
For a newline you kan try to insert a <br> in TableData

Ad
0
 

Author Comment

by:m-jansen
ID: 16976500
It have problems with newline too. What to use instead of "\n"
0
 

Author Comment

by:m-jansen
ID: 16976511
thanks alot. so it's html I must use as reference when using escape characters in asp?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question