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
Joseph K
NA
255
30.4k
Export Data To Excel Hindi From DataTable In Asp.net
May 26 2017 7:10 AM
I am using below code to export data to excel from datatable.But when i download it is showing ???.I had UTF8 encoding but it's not working.Can anyone help me out?
public void ExportToExcel(DataTable dt)
{
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "Customers.xls"));
Response.ContentType = "application/ms-excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Charset = "";
DataTable dt1 = dt;
string str = string.Empty;
foreach (DataColumn dtcol in dt1.Columns)
{
Response.Write(str + dtcol.ColumnName);
str = "\t";
}
Response.Write("\n");
foreach (DataRow dr in dt1.Rows)
{
str = "";
for (int j = 0; j < dt1.Columns.Count; j++)
{
Response.Write(str + Convert.ToString(dr[j]));
str = "\t";
}
Response.Write("\n");
}
Response.End();
}
Reply
Answers (
1
)
how to configure outlook calendar in mvc application
Attribute routing all steps are done in VS2015 but showing