10 TIPs - To Become a Good Developer/Programmer
Why Join
Become a member
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
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Riddhi Valecha
636
3.2k
342k
Export To Word - Panel and placeholder - IMP
Jun 12 2018 11:09 AM
Dear Team,
I need help in exporting an entire Panel () to word document.
My ASPX Design is -
<
body
>
<
asp:Panel
id
=
"panel2"
runat
=
"server"
width
=
"100%"
>
<
table
width
=
"1024px"
>
<
tr
>
<
td
>
<
asp:Gridview
id
=
"grdData"
runat
=
"server"
>
</asp:GridView
>
td
>
tr
>
<
tr
>
<
td
>
<
asp:Placeholder
id
=
"ph1"
runat
=
"server"
>
</asp:Placeholder
>
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Gridview
id
=
"grdDataAdmin"
runat
=
"server"
>
</
asp:GridView
>
</
td
>
</
tr
>
</
table
>
</
asp:Panel
>
</body
>
By Button Code -
protected
void
Export(
object
sender, EventArgs e)
{
Response.Clear();
Response.Buffer =
true
;
Response.ContentType =
"application/vnd.word"
;
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader(
"Content-Disposition"
,
"attachment;filename=History.doc"
);
Response.Charset =
""
;
EnableViewState =
false
;
Table table =
new
Table();
TableRow row =
new
TableRow();
row.Cells.Add(
new
TableCell());
row.Cells[0].Controls.Add(panel2);
table.Rows.Add(row);
System.IO.StringWriter oStringWriter =
new
System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter =
new
System.Web.UI.HtmlTextWriter(oStringWriter);
table.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
}
Issue -
I am loading the placeholder on Page Load Event.
Entire Panel is exported , but not the placeholder.
How do I do this?
Please help...as this is a bit urgent...
Reply
Answers (
6
)
modalpopupextender have an element style change .
Error in return view