Hi @Brian Tan,
Definitely, ComboBoxes will get render to basic html code so you could use bootstrap to manage it. Firstly, use need to incorporate the bootstrap framework's CSS styles and JavaScript functionality. For example:
<link rel="stylesheet" href=https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css><script src=https://code.jquery.com/jquery-3.3.1.slim.min.js></script> <script src=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js></script> <script src=https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js></script>
Note: Customize combobox might result input and button are not aligned. So, it’s better to use flex to make the button in center. Also Use bootstrap will make the default down-arrow disappear. So it’s better to download a down-arrow png file and use it.
Here is the example for you.
<style>
.bootstrap-combobox input {
border: 1px solid grey;
border-radius: 0.25rem;
padding: 0.375rem 0.75rem;
font-size: 1rem;
}
.bootstrap-combobox .ajax__combobox_inputcontainer .ajax__combobox_textboxcontainer input {
width: calc(100% - 30px);
}
.bootstrap-combobox .ajax__combobox_buttoncontainer button {
display: flex;
align-items: center;
border: none;
border-radius: 0 0.25rem 0.25rem 0;
background: #007bff url('./image/down-arrow.png') no-repeat center center;
background-size: contain;
color: black;
}
</style>
After you define the css style in your ComboBoxes, use CssClass to implement it.
<ajaxToolkit:ComboBox ID="ComboBox1" runat="server" AutoPostBack="False" DropDownStyle="DropDown"
ClientIDMode="Static" AutoCompleteMode="suggest" CaseSensitive="False" Width="160px"
CssClass="bootstrap-combobox">
<asp:ListItem Text="Item 1" Value="1"></asp:ListItem>
<asp:ListItem Text="Item 2" Value="2"></asp:ListItem>
</ajaxToolkit:ComboBox>
Style gets changed. Result:
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.