如果有人帮忙,我会很感激。我试图在我的asp页面中使用一个组合框,但我发现的所有使用ajax的组合框都有其他选择吗?
非常感谢你的帮助
答案 0 :(得分:1)
如何在经典的asp代码中使用HTML <select>
标记呢?
答案 1 :(得分:0)
像这样使用ASP.NET DropDownList Control
$
$
列表项目1
$
答案 2 :(得分:0)
这不会退出组合框...
ASP是两套控件: 1:文本框和按钮 2:下拉列表和按钮
按钮单击事件隐藏(自身)和显示(其他)。
<div class="control-group">
<asp:Label ID="Label8" class="control-label" runat="server" Text="Company"> </asp:Label>
<div class="row">
<div class="col-md-12 ">
<asp:TextBox ID="txtCompanyName" class="control-label" runat="server"
CssClass="form-control btn-group"
Width="240px"
AutoCompleteType="Disabled">
</asp:TextBox>
<asp:LinkButton ID="btnCompanySearch"
runat="server"
CssClass="btn btn-primary"
ToolTip="Company dropdown list" OnClick="btnCompanySearch_Click">
<span class="glyphicon glyphicon-search"></span>
</asp:LinkButton>
</div>
<div class="col-md-12">
<asp:DropDownList ID="ddlCompanyName" runat="server"
CssClass="form-control btn-group"
Width="240px"
AutoPostBack="true" Visible="false"
OnSelectedIndexChanged="ddlCompany_SelectedIndexChanged">
</asp:DropDownList>
<asp:LinkButton ID="btnCompanyText"
runat="server"
CssClass=" btn btn-primary"
Visible="false"
ToolTip="Enter company manually" OnClick="btnCompanyText_Click">
<span class="glyphicon glyphicon-font"></span>
</asp:LinkButton>
</div>
</div>
</div>
还有背后的代码...
protected void ddlCompany_SelectedIndexChanged(object sender, EventArgs e)
{
txtCompanyName.Text = ddlCompanyName.SelectedValue == "-1" ? string.Empty: ddlCompanyName.SelectedValue;
btnCompanyText_Click(this, EventArgs.Empty);
}
protected void btnCompanySearch_Click(object sender, EventArgs e)
{
Search(false);
ddlCompanyName.Focus();
}
protected void btnCompanyText_Click(object sender, EventArgs e)
{
Search(true);
txtCompanyName.Focus();
}
private void Search(bool bVal)
{
txtCompanyName.Visible = bVal;
btnCompanySearch.Visible = bVal;
btnCompanyText.Visible = !bVal;
ddlCompanyName.Visible = !bVal;
}