0

如何使用 Javascript 禁用或启用 .NET 框架的文件上传控制?

有没有人有想法,请帮忙。

提前致谢。

4

2 回答 2

1

尝试这样做:

<script type = "text/javascript">
    function EnableDisable(rbl) {
        var rb = rbl.getElementsByTagName("input");
        document.getElementById("<%=FileUpload1.ClientID %>").disabled = true;
        for (var i = 0; i < rb.length; i++) {
            if (rb[i].value == 1 && rb[i].checked) {
                document.getElementById("<%=FileUpload1.ClientID %>").disabled = false;
            }
        }
    }
</script>



<form runat = "server">
    <asp:RadioButtonList ID="RadioButtonList1" runat="server" onclick = "EnableDisable(this)">
        <asp:ListItem Text = "Yes" Value = "1"></asp:ListItem>
        <asp:ListItem Text = "No" Value = "2"></asp:ListItem>
    </asp:RadioButtonList>
    <asp:FileUpload ID="FileUpload1" runat="server" disabled = "disabled"/>
</form>
于 2012-07-24T08:54:15.897 回答
0

采用

document.getElementById(FileUploadControlID).disabled = true;

于 2012-07-24T09:12:29.517 回答