Trying to make Label control visible....hard time to do that

Hello folks,

I have a master-content form.

All the controls on the content form are server control.
When clicked on button control, a label control should become visible.

I have read the article at http://www.vanseodesign.com/css/visibility-vs-display/

But I still can’t make it visible. Here is the code so far. Could someone let me know my mistake?

<%@ Page Title="" Language="C#" MasterPageFile="~/SiteMasterPage.master" AutoEventWireup="true" CodeFile="DynamicTextboxControls.aspx.cs" Inherits="DynamicTextboxControls" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h3>Dynamic Textbox Controls</h3>
<fieldset style="width: 300px">
        <legend>From</legend>

            <asp:RadioButtonList ID="RadioButtonList1" runat="server">
                <asp:ListItem>Database</asp:ListItem>
                <asp:ListItem>Interactive</asp:ListItem>
            </asp:RadioButtonList>

    </fieldset>


        <table border="1">
            <tr>
                <td class="style1"><asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="Validate();"/>
                </td>
            </tr>
        </table>


        <asp:Label runat="server" id="Label1" style="display: none;" />



    <script type="text/javascript" language="javascript">

        function Validate() {

            document.getElementById("<%=Label1.ClientID%>").style.display = "visible";



        }
    </script>
</asp:Content>

Thanks much

Hi,

display: visible; isn’t a correct CSS value.
You want to make this display: block;

http://reference.sitepoint.com/css/display

Mark,

All I changed after your suggestion was the following.
function Validate() {

        document.getElementById("&lt;%=Label1.ClientID%&gt;").style.display = "block";
    }

The label control shows up when I click on the button. But it disappears right away. I don’t know why. When I click the button again, it displays for a second that’s all.

In the design time, the Label control’s visible property has been set to True.

In the page load event I made it hidden. My idea is when clicked on Button control, the above code should make the label control visible. It is making visible but the label control disappears immediately. Don’t know why it disappears

protected void Page_Load(object sender, EventArgs e)
{

    Label1.Style.Add("visibility", "hidden");
}

This is what I found so far.

If I use a HTML button control intead of using button asp control, it works fine (meaning the label control doesn’t disappear). But if I use asp button control, the momement I click on button control, the label appears and it disappears…looks like I should somehow tell the asp button control not to invoke the server side event of that control…

any suggestions on how to do this?