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
dhoni kholi
NA
198
42.3k
How to Export in Excel
Dec 30 2019 11:41 PM
This is my Code
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
runat
=
"server"
>
<
div
id
=
"page-wrapper"
>
<
div
class
=
"col-md-12"
>
<!-- Form Elements -->
<
div
class
=
"panel panel-info"
>
<
div
class
=
"panel-heading"
>
<
h3
style
=
"text-shadow: 2px 2px #79aed8;"
>
Barcode List
</
h3
>
</
div
>
<
div
class
=
"panel-body"
>
<
div
id
=
"Barcode"
>
<
h1
align
=
"center"
style
=
"text-decoration: underline; font-size: x-large; font-weight: bold"
>
Barcode
</
h1
>
<
asp:Panel
ID
=
"Panel1"
runat
=
"server"
>
<
asp:Label
ID
=
"lblPname"
runat
=
"server"
Text
=
""
Font-Bold
=
"True"
>
</
asp:Label
>
<
br
/>
<
%--
<
asp:PlaceHolder
ID
=
"phBarcode"
runat
=
"server"
Visible
=
"true"
>
</
asp:PlaceHolder
>
</
asp:Panel
>
--%
>
<
asp:Image
ID
=
"Image1"
runat
=
"server"
Height
=
"70px"
Width
=
"250px"
/>
<
div
class
=
"table-responsive"
;
>
<
table
class
=
"table"
>
<
tbody
>
<
tr
>
<
td
>
<
asp:Button
ID
=
"btnPPdf"
runat
=
"server"
Text
=
"Print"
CssClass
=
"btn-info"
Width
=
"100px"
/>
<
asp:Button
ID
=
"btnExcel"
runat
=
"server"
Text
=
"Excel"
CssClass
=
"btn-success"
Width
=
"100px"
onclick
=
"btnExcel_Click"
/>
<
asp:Button
ID
=
"btnBack"
runat
=
"server"
Text
=
"Back"
CssClass
=
"btn-danger"
Height
=
"35px"
Width
=
"100px"
/>
</
td
>
</
tr
>
</
tbody
>
</
table
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
asp:Content
>
I want export to Excel in Content of Inside the Panel
I use this Code this
protected
void
btnExcel_Click(
object
sender, EventArgs e)
{
Response.Clear();
Response.AddHeader(
"content-disposition"
,
"attachment;filename=FileName.xls"
);
Response.Charset =
""
;
Response.ContentType =
"application/vnd.xls"
;
System.IO.StringWriter stringWrite =
new
System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite =
new
HtmlTextWriter(stringWrite);
Panel1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
My output is
I want that Lable and Image
Reply
Answers (
8
)
Mvc WEB API and Dotnet core WEB API
Web API - Convert XML output to datatable and display data