Popular Posts
jQuery : post/get using data() as param object <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html... android.intent.action.SCREEN_ON & android.intent.action.SCREEN_OFF First, I've tried create a receiver to receive screen on/off and register receiver on AndroidManifest.xml like below, but unfortunately ... runas RUNAS 使用方法: RUNAS [ [/noprofile | /profile] [/env] [/netonly] ] /user: program RUNAS [ [/noprofile | /profile] [/env] [/netonly] ...
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;
        }
    }
}