Click here to Skip to main content
14,735,206 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<head runat="server">
    <script type="text/javascript">
        function RadioClick() {
            document.getElementById("FileUpload1").style.visibility = "visible";
    <form id="form1" runat="server">
    <asp:RadioButton ID="rbClderFormt" runat="server" GroupName="Format"/>
    <asp:RadioButton ID="rdTableFormat" runat="server" GroupName="Format"/>
    <asp:RadioButton ID="rdUploadFormat" runat="server" GroupName="Format"/>

     <asp:FileUpload ID="FileUpload1" runat="server" Visible="false"/>

The above is the code. I have to change the visibility of "FileUpload1" When I click the rdUploadFormat radioButton. In the back end I m using the following code

protected void Page_Load(object sender, EventArgs e)
            if (!IsPostBack)
                rdUploadFormat.Attributes.Add("OnClick", "return RadioClick()");

The above is not working. I am getting the alert message but the FileUpload is not visible.

1 solution

remove Visible='false' and add style='display:none' to your file upload control as mentioned below :

<asp:fileupload id="FileUpload1" runat="server" style="display: none" xmlns:asp="#unknown" />

and update javascript method as shown below :
function RadioClick() {
        document.getElementById("FileUpload1").style.display = "block";
Prasaad SJ 17-Oct-13 0:54am
Thanks for your answer.

Mohan Prasath S J

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900