Okay here is the code for the form that I did:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ProductUpload.aspx.cs" Inherits="ProductUpload" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<asp:Button ID="ButtonUpload" runat="server"
Text="Upload Excel Spreadsheet" />
</td>
<td>
<asp:Button ID="ButtonView" runat="server"
text="View Excel Data" />
</td>
<td>
<asp:Button ID="ButtonImport" runat="server"
text="Import Excel Data" />
</td>
</tr>
</table>
<asp:Panel ID="PanelUpload" runat="server" Visible="false" Width="240px">
<asp:FileUpload ID="FileUploadExcel" runat="server" /><br />
Please select an excel file to import<br />
<asp:Button ID="ButtonUploadFile" runat="server" Text="Upload File" OnClick="ButtonUploadFile_Click" />
<br /><br />
<asp:Label ID="LabelUpload" runat="server" Text=""></asp:Label>
</asp:Panel>
<asp:Panel ID="PanelImport" runat="server" Visible="false">
</asp:Panel>
<asp:Panel ID="PanelView" runat="server" Visible="false">
</asp:Panel>
</div>
</form>
</body>
</html>
NOW HERE IS WHERE I AM NOT SURE:
The Code BEHIND
CAN I do this (more
vb than C#)
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ProductUpload : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ButtonUploadFile_Click(object sender, EventArgs e)
{
FileUploadExcel.SaveAs(Server.MapPath("~/ExcelImport.xls"));
LabelUpload.Text = "Upload File Name:" & _;
FileUploadExcel.PostedFile.FileName & "<br>" & _;
"Type: " & _;
FileUploadExcel.PostedFile.ContentType & _;
"File Size:" & _;
FileUploadExcel.PostedFile.ContentLength & " kb <br>";
}
}
}