Note that there are some explanatory texts on larger screens.

plurals
  1. POChange Form Field Visibility in ModalPopupExtender
    primarykey
    data
    text
    <p>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: <a href="https://stackoverflow.com/questions/7773/change-visibility-of-asp-net-label-with-javascript">Change visibility of ASP.NET label with JavaScript</a>.</p> <p>Javascript:</p> <pre><code>&lt;script type="text/javascript"&gt; function ShowHide() { if(document.getElementById('&lt;%=DdlASVisibilityTest.ClientID%&gt;') == "Show") { document.getElementById('&lt;%=LblASBillingName.ClientID%&gt;').style.display = 'inherit'; document.getElementById('&lt;%=TxtASBillingName.ClientID%&gt;').style.display = 'inherit'; } if(document.getElementById('&lt;%=DdlASVisibilityTest.ClientID%&gt;') == "Hide") { document.getElementById('&lt;%=LblASBillingName.ClientID%&gt;').style.display = 'none'; document.getElementById('&lt;%=TxtASBillingName.ClientID%&gt;').style.display = 'none'; } { &lt;/script&gt; </code></pre> <p>asp.net:</p> <pre><code>&lt;asp:ModalPopupExtender OKControlID="BtnASOkay" CancelControlID="BtnASCancel" BackgroundCssClass="modalBackground" DropShadow="True" ID="BtnAddSupplier_ModalPopupExtender" runat="server" DynamicServicePath="" Enabled="True" TargetControlID="BtnAddSupplier" PopupControlID="PnlAddSupplier"&gt; &lt;Animations&gt; &lt;OnShown&gt; &lt;FadeIn Duration="0.25" Fps="40" /&gt; &lt;/OnShown&gt; &lt;OnHiding&gt; &lt;FadeOut Duration="0.25" Fps="40" /&gt; &lt;/OnHiding&gt; &lt;/Animations&gt; &lt;/asp:ModalPopupExtender&gt; &lt;asp:RoundedCornersExtender ID="RCE" runat="server" TargetControlID="PnlAddSupplier" Radius="6" Corners="All" /&gt; &lt;asp:Button ID="BtnAddSupplier" runat="server" CssClass="buttonsmall" Text="Add Suplier" /&gt; &lt;asp:Panel ID="PnlAddSupplier" CssClass ="panel" runat="server"&gt; &lt;div class="ASHeader"&gt; &lt;asp:Label ID="LblASHeader" runat="server" Text="Add Supplier" CssClass="bodytxt" Font-Bold="True"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;div class="ASInputs"&gt; &lt;asp:Table runat="server"&gt; &lt;asp:TableRow ID="TRASVisibilityTest" runat="server"&gt; &lt;asp:TableCell ID="TCLblASVisibilityTest" runat="server"&gt;&lt;asp:Label ID="LblASVisibilityTest" runat="server" Text="Test Visibility" CssClass="bodytxt" Font-Bold="False"&gt;&lt;/asp:Label&gt;&lt;/asp:TableCell&gt; &lt;asp:TableCell ID="TCDdlASVisibilityTest" runat="server"&gt;&lt;asp:DropDownList ID="DdlASVisibilityTest" runat="server" onchange="ShowHide()"&gt; &lt;asp:ListItem&gt;Show&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;Hide&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt;&lt;/asp:TableCell&gt; &lt;/asp:TableRow&gt; &lt;asp:TableRow ID="TRASBillingName" runat="server"&gt; &lt;asp:TableCell ID="TCLblASBillingName" runat="server"&gt;&lt;asp:Label ID="LblASBillingName" runat="server" Text="Supplier's Billing Name" CssClass="bodytxt" Font-Bold="False" style="display: none;"&gt;&lt;/asp:Label&gt;&lt;/asp:TableCell&gt; &lt;asp:TableCell ID="TCTxtASBillingName" runat="server"&gt;&lt;asp:TextBox ID="TxtASBillingName" CssClass="bodytxt" runat="server" style="display: none;"&gt;&lt;/asp:TextBox&gt;&lt;/asp:TableCell&gt; &lt;/asp:TableRow&gt; &lt;/asp:Table&gt; &lt;/div&gt; &lt;div class="DivASControls" align="center"&gt; &lt;asp:Button ID="BtnASOkay" runat="server" CssClass="buttonsmall" Text="Add Supplier" style="display: none;" /&gt; &lt;asp:Button ID="BtnASCancel" runat="server" CssClass="buttonsmall" Text="Cancel" /&gt; &lt;/div&gt; &lt;/asp:Panel&gt; </code></pre> <p>Thanks a lot in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload