Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8032095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:17:37+00:00 2026-06-05T01:17:37+00:00

Wanted to know if there’s a way to change a form field’s visibility within

  • 0

Wanted to know if there’s a way to change a form field’s visibility within a ModalPopup (from ModalPopupExtender) based upon a DropDownList’s change in value. This page’s technique doesn’t seem to work: Change visibility of ASP.NET label with JavaScript.

Javascript:

<script type="text/javascript">
    function ShowHide() {
        if(document.getElementById('<%=DdlASVisibilityTest.ClientID%>') == "Show") {
            document.getElementById('<%=LblASBillingName.ClientID%>').style.display = 'inherit';
            document.getElementById('<%=TxtASBillingName.ClientID%>').style.display = 'inherit';
        }
        if(document.getElementById('<%=DdlASVisibilityTest.ClientID%>') == "Hide") {
            document.getElementById('<%=LblASBillingName.ClientID%>').style.display = 'none';
            document.getElementById('<%=TxtASBillingName.ClientID%>').style.display = 'none';
        }
    {
</script>

asp.net:

<asp:ModalPopupExtender OKControlID="BtnASOkay" CancelControlID="BtnASCancel" BackgroundCssClass="modalBackground" DropShadow="True" ID="BtnAddSupplier_ModalPopupExtender" runat="server" DynamicServicePath="" Enabled="True" TargetControlID="BtnAddSupplier" PopupControlID="PnlAddSupplier">
    <Animations>
        <OnShown>
            <FadeIn Duration="0.25" Fps="40" />
        </OnShown>
        <OnHiding>
            <FadeOut Duration="0.25" Fps="40" />
        </OnHiding>
</Animations>
</asp:ModalPopupExtender>
<asp:RoundedCornersExtender ID="RCE" runat="server" TargetControlID="PnlAddSupplier" Radius="6" Corners="All" />
<asp:Button ID="BtnAddSupplier" runat="server" CssClass="buttonsmall" Text="Add Suplier" />
<asp:Panel ID="PnlAddSupplier" CssClass ="panel" runat="server">
    <div class="ASHeader">
        <asp:Label ID="LblASHeader" runat="server" Text="Add Supplier" CssClass="bodytxt" Font-Bold="True"></asp:Label>
    </div>
    <div class="ASInputs">
        <asp:Table runat="server">
            <asp:TableRow ID="TRASVisibilityTest" runat="server">
                <asp:TableCell ID="TCLblASVisibilityTest" runat="server"><asp:Label ID="LblASVisibilityTest" runat="server" Text="Test Visibility" CssClass="bodytxt" Font-Bold="False"></asp:Label></asp:TableCell>
                <asp:TableCell ID="TCDdlASVisibilityTest" runat="server"><asp:DropDownList ID="DdlASVisibilityTest" runat="server" onchange="ShowHide()">
                    <asp:ListItem>Show</asp:ListItem>
                    <asp:ListItem>Hide</asp:ListItem>
                </asp:DropDownList></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TRASBillingName" runat="server">
                <asp:TableCell ID="TCLblASBillingName" runat="server"><asp:Label ID="LblASBillingName" runat="server" Text="Supplier's Billing Name" CssClass="bodytxt" Font-Bold="False" style="display: none;"></asp:Label></asp:TableCell>
                <asp:TableCell ID="TCTxtASBillingName" runat="server"><asp:TextBox ID="TxtASBillingName" CssClass="bodytxt" runat="server" style="display: none;"></asp:TextBox></asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </div>
    <div class="DivASControls" align="center">
        <asp:Button ID="BtnASOkay" runat="server" CssClass="buttonsmall" Text="Add Supplier" style="display: none;" />
        <asp:Button ID="BtnASCancel" runat="server" CssClass="buttonsmall" Text="Cancel" />
    </div>
</asp:Panel>

Thanks a lot in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:17:39+00:00Added an answer on June 5, 2026 at 1:17 am

    It doesn’t look like you are properly checking the value/text of your dropdown. Instead, you are comparing the control itself with the value of “Show” or “Hide”. Try changing your code to this and see if it helps:

    <script type="text/javascript">
        function ShowHide() 
        {
            var visibilityElem = document.getElementById('<%=DdlASVisibilityTest.ClientID%>');
            var visibilityElemText = visibilityElem.options[visibilityElem.selectedIndex].text;
            var display = (visibilityElemText == 'Show') ? 'inherit' : 'none';
    
            document.getElementById('<%=LblASBillingName.ClientID%>').style.display = display;
            document.getElementById('<%=TxtASBillingName.ClientID%>').style.display = display;
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to know if there is a better way to layout my form
i wanted to know if there is a way where an UIImage moves based
I wanted to know if there's a way to manipulate line breaks within PHP.
Just wanted to know is there a way to protect an application from getting
I wanted to know if there is a way, from a sh script, to
I just wanted to know if there is a way to start recording from
I wanted to know if there is a way to stop Javascript from calling
I wanted to know if there is way to log the mysql queries in
I wanted to know if there's a way I can bind an Asp.net Ajax
I wanted to know if there is any way to synchronize (or exchanging files)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.