By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,583 Members | 617 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,583 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.