TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Manoj Maharana
NA
362
128.5k
Notepad c# txt Design
Aug 12 2016 1:45 AM
I want to show all the data horiozantally in a txt file
Problem is that all the data are overlap
I want to show txt format in
xyz:...
pqr:...
.......................
just like
I have taken all the data in a datatable here:
dtRecords.Rows.Add(obj);
//Build the Text file data.
string txt = string.Empty;
foreach (DataColumn column in dtRecords.Columns)
{
//Add the Header row for Text file.
txt += column.ColumnName + "\t\t";
}
//Add new line.
txt += "\r\n";
foreach (DataRow row in dtRecords.Rows)
{
foreach (DataColumn column in dtRecords.Columns)
{
//Add the Data rows.
txt += row[column.ColumnName].ToString() + "\t\t";
}
//Add new line.
txt += "\r\n";
}
//Download the Text file.
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=SqlExport.txt");
Response.Charset = "";
Response.ContentType = "application/text";
Response.Output.Write(txt);
Response.Flush();
Response.End();
Can anyone guide me how to do??
Reply
Answers (
3
)
How to all Valiadtion in Server Side MVC
Saving HTML into excel without showing save/open dialog.