<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="Button1" />
</Triggers>
<ContentTemplate>
<asp:MultiView ID="MultiView1" runat="server"
ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<asp:Button Text="next"
runat="server" onclick="Unnamed1_Click" />
</asp:View>
<asp:View ID="View2" runat="server">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button"
style="width: 56px" />
<asp:FileUpload ID="fileupload2" runat="server" />
</asp:View>
</asp:MultiView>
</ContentTemplate>
</asp:UpdatePanel>
后面的代码是
protected void Button1_Click(object sender, EventArgs e)
{
if (fileupload2.HasFile)
{
//code..
}
}
protected void Unnamed1_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 1;
}
当我第一次单击 Button1 上传图像时,fileupload2.HasFile 返回“false”
无需再次刷新页面尝试上传相同的图片然后 fileupload2.HasFile 返回“true”
在 View1 中正常工作。问题在于视图 2
该文件上传有什么问题?