Popular Posts
javax.net.ssl.SSLHandshakeException: Connection closed by peer in Android 5.0 Lollipop Recently, there is a error occurs when access website via ssl connection like below although it worked fine several days ago. // Enable SSL... Hierarchical Query Start with connect by prior 階層式查詢用法 SELECT s.role_id, s.role_name, s.role_base_on, b.role_name role_base_on_name FROM m_usr_role s... Tired of Hibernate? Try JDBI in your code JDBI Quick sample ICategoryDAO.java : create a data access interface (implement is not required) package com.prhythm.erotic.task.data....
Blog Archive
Stats
Bug. FileUpload within UpdatePanel
Example below : the FileUpload2 will work, but FileUpload1 won't.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="local_Default" %>

<!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 runat="server">
    <title>FileUpload & UpdatePanel</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <div>
            FileUpload component within in UpdatePanel</div>
        <div>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <div>
                        <asp:FileUpload ID="FileUpload1" runat="server" />
                    </div>
                    <div>
                        <asp:Button ID="Button1" runat="server" Text="確認" OnClick="Button1_Click" />
                    </div>
                    <asp:Label ID="Label1" runat="server"></asp:Label>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        <div>
            <div>
                FileUpload</div>
            <div>
                <asp:FileUpload ID="FileUpload2" runat="server" />
            </div>
            <div>
                <asp:Button ID="Button2" runat="server" Text="確認" OnClick="Button2_Click" />
            </div>
            <asp:Label ID="Label2" runat="server"></asp:Label>
        </div>
    </div>
    </form>
</body>
</html>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class local_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            Label1.Text = FileUpload1.PostedFile.FileName;
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        if (FileUpload2.HasFile)
        {
            Label2.Text = FileUpload2.PostedFile.FileName;
        }
    }
}