1

How can i disable or enable File upload control of .NET framework using Javascript??

Does any one have idea, please help.

Thanks in advance.

2 Answers 2

1

Try doing this:

<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>
Sign up to request clarification or add additional context in comments.

Comments

0

Use

document.getElementById(FileUploadControlID).disabled = true;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.