1

我陷入困境,如果有人帮忙,我将不胜感激。我正在尝试在我的 asp 页面中使用组合框,但我发现所有使用 ajax 的组合框都有其他选择吗?

非常感谢你的帮助

4

3 回答 3

1

<select>在您的经典 asp 代码中使用 HTML 标记怎么样?

于 2012-04-28T20:50:53.907 回答
0

$ $像这个列表项 一样使用 ASP.NET DropDownList 控件 1$

于 2012-04-28T22:56:52.767 回答
0

这不是退出组合框...

ASP 是两组控件: 1:文本框和按钮 2:下拉列表和按钮

按钮单击事件 hide(self) 和 show(other)。

        <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;
}
于 2018-10-09T18:43:46.650 回答