Help with this eror.. (Dataset as excel..)

Y

yyt

I am programmatically adding a web user control to a webform. This User
Control displays the employee listing from a database into a datagrid. But
the calling webform should render the data as a excel spreadsheet.
I had the same logic working when the app had a simple web form with a
datagrid embedded in it. But it gives error when I separate the logic into a
pagelet. Below are the details:

=========
Code:
webform1.aspx
<%@ Page ....%>
<%@ Reference Control ="~/emplist.ascx"%>
<!DOCType....>
<html>
<head>
<link href="../styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<form id="Test" method="post" runat="server"></form>
</body>
</html>

webform1.aspx.vb
private sub Page_Load(Byval sender as System.object, ...)
response.contenttype = "application/ms-excel"
response.AddHeader("Content-Disposition","inline;filename=emplist.xls")

dim sPath as string = "~/modules/emplist.ascx"
dim c1 as Control = LoadControl(sPath)
dim objForm as Control = Page.FindControl('Test") ' pass the name
of the form
objForm.Controls.Add(c1)
end sub

emplist.ascx: has a datagrid and the binds a dataset in the page_load event.

Error:
"Microsoft Excel" error prompt: Unable to read file.
"HTML Import Errors" prompt:
Problems came us in the following areas during load:
Missing fle: ...\Local Settings\Temporary Internet
Files\Content.IE5\styles.css
=========

Is there a better ( and easier ) approach to the above?

Thanks
yyt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top