如何设置可见的真假在asp.net使用javascript下拉列表框中 [英] how to set visible true and false for drop down list box using javascript in asp.net

查看:128
本文介绍了如何设置可见的真假在asp.net使用javascript下拉列表框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<asp:DropDownList ID="ddloption" runat="server" Visible="false">
  <asp:ListItem Text="Active" Value="Active"></asp:ListItem>
  <asp:ListItem Text="D-Active" Value="D-Active"></asp:ListItem>
</asp:DropDownList>

function boxchange(dd)
{
  document.getElementById("<%= ddloption.ClientID%>").visibility = "visible";
}

ddloption为空,我m到处...你能告诉我如何与这个工作。

ddloption is null, what i m getting...can you tell me how to work with this.

推荐答案

当你有一个 =服务器可见=假 ASP的控制,这是不呈现在html。尝试是这样的:

When you have a runat="server" visible="false" asp control, it is not rendered in the html. Try something like this:

<div id="wrapper" style="display: none;">
    <asp:DropDownList ID="ddloption" runat="server">
        <asp:ListItem Text="Active" Value="Active"></asp:ListItem>
        <asp:ListItem Text="D-Active" Value="D-Active"></asp:ListItem>
    </asp:DropDownList>
</div>


function boxchange(dd)
    {
          document.getElementById("wrapper").style.display = "block";
    }

这篇关于如何设置可见的真假在asp.net使用javascript下拉列表框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆