Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to set visibility false for the section(detail) but i don't want to suppress section.
inside the box object 2 text box are there.if text field is empty means i need to set box object and label to false but i don't want to suppress the section.i need blank section(space) for the section with don't have the data that it.

NOTE:i need blank section(space) and box object also should not visible for the section with don't have the data that it. am using visual studio 2008 IDE.
please help me to do this.
Posted
Updated 30-Dec-13 21:13pm
v2

1 solution

Hi,

You could try hiding the controls instead of div.
Here is the code snippet you could make use of.
XML
<script type="text/javascript">
        function hideControls() {
            var txtVal = document.getElementById('MainContent_txtBx').value;
            var divToHide = document.getElementById('MainContent_dynamicContent');
        if (txtVal == '') {
            document.getElementById('MainContent_txtBx').style.display = 'none';
            document.getElementById('MainContent_lbl').style.display = 'none';
            }
        }
    </script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

    <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="hideControls()" />

        <div id="dynamicContent" runat="server" style="height:50px;border-style:solid;border-color:#ff0000 #0000ff;">
        <asp:Label ID="lbl" runat="server" Text="Sample message"></asp:Label>
        <asp:TextBox ID="txtBx" runat="server" />
        </div>
        </asp:Content>

Hope this helps you a bit.

Regards,
RK
 
Share this answer
 

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