I've been looking for ways to use my <asp:LinkButton>
as the dropdown control for my <asp:DropDownList>
on my asp.net website but the search results always suggest to customize the dropdown list either by <"select">
or <"option">. I have no problems with my <asp:DropDownList>
its just that when I apply <CssClass="form-control">
on it, it does not show the arrow which is the indicator that it is indeed a dropdown list (which I guess was not included on the css-template I downloaded):
Here's my code for this:
<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>
Therefore, what I did on my other <asp:DropDrownList>
is put it inside a <div class="input-group">
and append an <asp:LinkButton>
beside it:
Here's my code for this:
<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>
But of course, when I click the link button, it just reloads the page and it doesn't open the dropdown list. My question is whether there's really a way to connect my <asp:LinkButton>
to the <asp:DropDownList>
or none? Thank you in advanced for answering my question!