如何解决是否可以在 ASP.NET 上使用 <asp:LinkButton> 打开 <asp:DropDownList>?
我一直在寻找在我的 asp.net 网站上使用我的 <asp:LinkButton>
作为我的 <asp:DropDownList>
的下拉控件的方法,但搜索结果总是建议通过 {{ 1}} 或 。我的 <"select">
没有问题,只是当我对其应用 <asp:DropDownList>
时,它没有显示箭头,这表明它确实是一个下拉列表(我猜它没有包含在我下载的 css 模板):
这是我的代码:
<CssClass="form-control">
因此,我在另一个 <div class="col-md-6 pl-1">
<div class="form-group">
<asp:Label ID="Label4" runat="server" Text="Branch"></asp:Label>
<asp:DropDownList ID="ddlBranch" runat="server" CssClass="form-control">
<asp:ListItem>Calamba</asp:ListItem>
<asp:ListItem>Tanauan</asp:ListItem>
<asp:ListItem>San Pablo</asp:ListItem>
</asp:DropDownList>
</div>
</div>
上所做的是将它放在 <asp:DropDrownList>
中并在其旁边附加一个 <div class="input-group">
:
这是我的代码:
<asp:LinkButton>
当然,当我单击链接按钮时,它只会重新加载页面,而不会打开下拉列表。我的问题是是否真的有办法将我的 <div class="col-md-5 pr-1">
<asp:Label ID="Label3" runat="server" Text="Account Type"></asp:Label>
<div class="input-group">
<asp:DropDownList ID="ddlAccountType" runat="server" CssClass="form-control" Height="2.7em" OnSelectedIndexChanged="ddlAccountType_SelectedIndexChanged">
<asp:ListItem>Savings</asp:ListItem>
<asp:ListItem>Current</asp:ListItem>
<asp:ListItem>Checking</asp:ListItem>
</asp:DropDownList>
<div class="input-group-append">
<div class="input-group-text">
<asp:LinkButton ID="btnAccountType" runat="server" Font-Underline="False" ForeColor="Black" CssClass="nc-icon nc-minimal-down" />
</div>
</div>
</div>
</div>
连接到 <asp:LinkButton>
或没有?预先感谢您回答我的问题!
解决方法
更新!!!
我不知道这是否可以被视为解决方案,但无论如何它给了我我想要的结果,所以...我所做的是使用
代码在 <style>
之前 </head>
(注意:我只是从我拥有的模板的 .form-control 类中复制了它的 css):
<style>
.accordion {
background-color: #FFFFFF;
border: 1px solid #DDDDDD;
border-radius: 4px;
color: #66615b;
line-height: normal;
height: auto;
font-size: 14px;
transition: color 0.3s ease-in-out,border-color 0.3s ease-in-out,background-color 0.3s ease-in-out;
box-shadow: none;
}
.accordion:focus {
border: 1px solid #9A9A9A;
box-shadow: none;
outline: 0 !important;
color: #66615B;
}
</style>
然后我的 <asp:DropDownList>
代码是这样的:
<div class="col-md-5 pr-1">
<asp:Label ID="Label3" runat="server" Text="Account Type"></asp:Label>
<div class="form-group">
<asp:DropDownList ID="ddlAccountType" runat="server" CssClass="accordion" Height="2.68em" Width="100%">
<asp:ListItem>Savings</asp:ListItem>
<asp:ListItem>Current</asp:ListItem>
<asp:ListItem>Checking</asp:ListItem>
</asp:DropDownList>
</div>
</div>
如果我下载的模板上的“.form-control”类也有下拉列表的样式,这无论如何都不会成为问题。
顺便说一句,感谢编辑我的问题以使其更具表现力的人。我实际上是这个平台的新手,所以我仍然不习惯它的一些功能。非常感谢!
也感谢@John 提供的链接!我会去检查一下,以防万一我需要它作为将来的参考。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。