Click here to Skip to main content
15,887,267 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: row increase by 1 Pin
Rishita_varma22-May-14 23:58
Rishita_varma22-May-14 23:58 
QuestionSSRS 2005 in ASP.net Pin
berba21-May-14 19:58
berba21-May-14 19:58 
AnswerRe: SSRS 2005 in ASP.net Pin
DamithSL22-May-14 5:47
professionalDamithSL22-May-14 5:47 
GeneralRe: SSRS 2005 in ASP.net Pin
berba26-May-14 1:13
berba26-May-14 1:13 
QuestionWeb deployment task failed Pin
Sultan Uz Zaman21-May-14 5:35
Sultan Uz Zaman21-May-14 5:35 
AnswerRe: Web deployment task failed Pin
DamithSL21-May-14 17:20
professionalDamithSL21-May-14 17:20 
AnswerRe: Web deployment task failed Pin
jkirkerx28-May-14 12:24
professionaljkirkerx28-May-14 12:24 
QuestionCreating Multiple sheets in C# from html table and downloading Pin
Kandepu Rajesh20-May-14 20:50
Kandepu Rajesh20-May-14 20:50 
I have a scenario where I have to create multiple sheets in excel and bind data to those sheets and download. Now I have code for creating 1 sheet. I have creatied a HTML Table and binded it to excel. In the same way I have to create multiple sheets from Html table and download the excel file.


filename = filename + " Case Study";
Query_ValuesSelection = "Select * from case_study_information where locid="+DD_Location.SelectedValue.ToString()+" and methodid="+DD_Methods.SelectedValue;
MySqlCommand command = new MySqlCommand(Query_ValuesSelection, con);
datareader = command.ExecuteReader();
if (datareader.HasRows)
{
datareader.Read();
sb.Append("<table class='Tickets'>");

//sb.Append("<tr style='color:white'>");
//sb.Append("<td style='background-color:#3a4f63' colspan=" + datareader.FieldCount.ToString() + "><b>" + DD_Location.SelectedItem.Text.ToString() + "</b></td>");
//sb.Append("</tr>");
datareader.Read();

for (int colCount = 0; colCount < datareader.FieldCount; colCount++)
{

string str = datareader.GetName(colCount).ToString();
if (datareader.GetName(colCount).ToString() == "Sample Photo")
{
sb.Append("<tr height='150'>");
sb.Append("<td><b>" + str + "</b></td>");
string filepath = Server.MapPath("Images//Case Studies//" + DD_Location.SelectedItem.Text.ToString() + ".png");
// sb.Append("<td><img src='http://localhost:53340/Retrospective/Images/epa.jpg'/></td>");
sb.Append("<td><img src='" + filepath + "'/></td>");

}
else
{
if (datareader.GetName(colCount).ToString() != "locid" && datareader.GetName(colCount).ToString() != "MethodId")
{
sb.Append("<tr>");
sb.Append("<td><b>" + str + "</b></td>");
sb.Append("<td><b>" + datareader[colCount].ToString().Trim() + "</b></td>");
}

}
sb.Append("</tr>");
}




sb.Append("</table>");
}
else
Response.Write(@"<script language='javascript'>alert('No Case Study Information for the selected location')</script>");
}
System.Text.StringBuilder sb1 = new System.Text.StringBuilder();
sb1 = sb;
if (datareader.HasRows)
{
HttpContext.Current.Response.ContentType = "Application/x-msexcel";
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=\"" + filename + ".xls" + "\"");
HttpContext.Current.Response.Write("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">");
HttpContext.Current.Response.Write("<head>");
HttpContext.Current.Response.Write("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>");
HttpContext.Current.Response.Write("<!--[if gte mso 9]><xml>");
HttpContext.Current.Response.Write("<x:ExcelWorkbook>");
HttpContext.Current.Response.Write("<x:ExcelWorksheets>");
HttpContext.Current.Response.Write("<x:ExcelWorksheet>");
HttpContext.Current.Response.Write("<x:Name>" + filename + "</x:Name>");
HttpContext.Current.Response.Write("<x:WorksheetOptions>");
HttpContext.Current.Response.Write("<x:Print>");
HttpContext.Current.Response.Write("<x:ValidPrinterInfo/>");
HttpContext.Current.Response.Write("</x:Print>");
HttpContext.Current.Response.Write("</x:WorksheetOptions>");
HttpContext.Current.Response.Write("</x:ExcelWorksheet>");
HttpContext.Current.Response.Write("</x:ExcelWorksheets>");
HttpContext.Current.Response.Write("</x:ExcelWorkbook>");
HttpContext.Current.Response.Write("</xml>");
HttpContext.Current.Response.Write("<![endif]--> ");
HttpContext.Current.Response.Write("</head>");

HttpContext.Current.Response.Write("<body>");

HttpContext.Current.Response.Write(sb.ToString());
//HttpContext.Current.Response.Write(sb1.ToString());

HttpContext.Current.Response.Write("</body>");
HttpContext.Current.Response.Write("</html>");


HttpContext.Current.Response.Write("<body>");

HttpContext.Current.Response.Write(sb.ToString());
//HttpContext.Current.Response.Write(sb1.ToString());

HttpContext.Current.Response.Write("</body>");
HttpContext.Current.Response.Write("</html>");




HttpContext.Current.ApplicationInstance.CompleteRequest();
}
QuestionGPRS Data Logger to Website IP Pin
Member 1082292919-May-14 19:14
Member 1082292919-May-14 19:14 
QuestionMessage Closed Pin
18-May-14 23:37
Member 1082843918-May-14 23:37 
Questionhow to run event of asp contol by javascript code? Pin
alireza672518-May-14 5:41
alireza672518-May-14 5:41 
AnswerRe: how to run event of asp contol by javascript code? Pin
Anurag Gandhi22-May-14 4:19
professionalAnurag Gandhi22-May-14 4:19 
QuestionHow to convert speech to text? Pin
Member 1066162816-May-14 23:32
Member 1066162816-May-14 23:32 
AnswerRe: How to convert speech to text? Pin
Kornfeld Eliyahu Peter17-May-14 8:22
professionalKornfeld Eliyahu Peter17-May-14 8:22 
AnswerRe: How to convert speech to text? Pin
Richard MacCutchan17-May-14 21:11
mveRichard MacCutchan17-May-14 21:11 
QuestionFailed to map Path in Report Viewer Pin
Ravindra Bisen16-May-14 21:23
Ravindra Bisen16-May-14 21:23 
AnswerRe: Failed to map Path in Report Viewer Pin
ZurdoDev2-Jun-14 9:49
professionalZurdoDev2-Jun-14 9:49 
QuestionCode is not calculating percentages correctly. Pin
samflex16-May-14 7:57
samflex16-May-14 7:57 
AnswerRe: Code is not calculating percentages correctly. Pin
jkirkerx16-May-14 11:49
professionaljkirkerx16-May-14 11:49 
GeneralRe: Code is not calculating percentages correctly. Pin
samflex16-May-14 13:18
samflex16-May-14 13:18 
GeneralRe: Code is not calculating percentages correctly. Pin
jkirkerx16-May-14 13:24
professionaljkirkerx16-May-14 13:24 
GeneralRe: Code is not calculating percentages correctly. Pin
samflex16-May-14 15:19
samflex16-May-14 15:19 
GeneralRe: Code is not calculating percentages correctly. Pin
jkirkerx16-May-14 16:26
professionaljkirkerx16-May-14 16:26 
QuestionPaging Dynamic Data in a Gridview Pin
Grajek15-May-14 7:47
Grajek15-May-14 7:47 
AnswerRe: Paging Dynamic Data in a Gridview Pin
Praneet Nadkar15-May-14 22:04
Praneet Nadkar15-May-14 22:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.