Hello folks,
I have Label control that I made invisible in the Page_Load event of the .aspx page.
When I click on a button, the label control should become visible. As expected, it becomes visible but disappears in a second....don't know why. Any help is greatly appreciated.
Code:<%@ 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> <div style="height: 149px"> <table border="1"> <tr> <td class="style1"> <asp:Label runat="server" id="Label1">visible </asp:Label> </td> </tr> </table> </div> <script type="text/javascript" language="javascript"> function Validate() { var varLabel = document.getElementById("<%=Label1.ClientID%>"); varLabel.style.display = "block"; varLabel.style.visibility = "visible"; } </script> </asp:Content>Code:protected void Page_Load(object sender, EventArgs e) { Label1.Style.Add("visibility", "hidden"); }




Reply With Quote