I'm in a bind and would really appreciate if someone helped out. I am trying to use a combo box in my asp page but all the ones that I found out use ajax are there any alternatives?
Thanks a lot for your help
How about just using a HTML <select>
tag in your classic asp code?
use ASP.NET DropDownList Control like this $
$
list item 1 $
This is not quit a combo box...
The ASP is two sets of controls: 1: textbox and button 2: dropdown list and button
The button click events hide(self) and 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>
And the code behind...
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;
}