我有一个简单的请求。我有这个:
所以,在我的.aspx:
<asp:FileUpload ID="myFileUpload" runat="server" onclick="LoadFile_Click" />
在按下“加载文件”按钮后,我希望页面将填充所选文档的数据。像这样:
在我的.aspx.cs
中 protected void LoadFile_Click(Object sender, EventArgs e)
{
string address = // a way to get the path of the file. How?
BindExcelToPage(address); // this method fills the web page with the data taken from the file uploaded;
}
答案 0 :(得分:0)
使用页面绑定BindExcel文件后,隐藏文件上载控件并替换为其标签(如果要使用标签和按钮)并在标签中设置文件名。这样看来文件就在那里。 FileUpload控件的文件名是只读的,因此您无法分配它。