简体   繁体   English

Ajax控件工具箱组合框在下拉列表中显示奇怪的项目符号

[英]Ajax control toolkit combobox showing weird bullets in dropdown

I'm using Ajax control toolkit's combobox in my website. 我在网站上使用的是Ajax控件工具箱的组合框 I'm binding custom type data to it dynamically. 我正在将自定义类型数据动态绑定到它。 Here is the aspx code I put for it. 这是我为此输入的aspx代码。

<ajaxToolkit:ComboBox ID="ddlAddAccount" runat="server" AutoPostBack="False" DropDownStyle="DropDownList" AutoCompleteMode="SuggestAppend" CaseSensitive="False" CssClass="ComboBoxStyle" ItemInsertLocation="Append"/>

Here is the CSS to that: 这是该CSS:

.ComboBoxStyle .ajax__combobox_itemlist 
{ 
            border: 1px solid YellowGreen;  
            font-size:medium;  
            font-family:Courier New;  
            padding-left: 0px;  
            list-style:none;
            list-style-type:none; 
}

The problem I'm facing is that when the DDL is rendered on the page, it is showing some weird boxes inside the dropdown. 我面临的问题是,在页面上呈现DDL时,它在下拉菜单中显示了一些奇怪的框。 They seem to be bullets. 他们似乎是子弹。 But despite putting list-style-type : none; 但是尽管放了list-style-type:没有; in the css, there is no change in the output. 在CSS中,输出没有变化。 That is, the weird boxes still show up. 也就是说,仍然出现怪异的盒子。 Here is the screen clip of the rendered combo box: 这是渲染的组合框的屏幕剪辑:

在此处输入图片说明

I even checked the rendered HTML mark up to see if there is any character that is being appended but there isn't. 我什至检查了呈现的HTML标记,以查看是否添加了任何字符,但没有。 The <li> tags in the <ul> tag simply has the list of elements that are binded. <ul>标记中的<li>标记只是具有绑定元素的列表。

Any Idea what this can be and how to get rid of these?? 任何想法这可能是什么以及如何摆脱这些? I tried ddlAddAccount.Items.Clear(); 我尝试了ddlAddAccount.Items.Clear(); before binding but that didn't help. 绑定之前,但这没有帮助。

Thanks a lot! 非常感谢!

Most probably some additional styling is conflicting with your combo-box. 很可能其他样式与您的组合框冲突。

Use a browser developer tool ( F12 developer tools in IE , Tools --> developer tools in chrome) and isolate the CSS applied on your list. 使用浏览器开发人员工具( F12 developer tools in IE Tools --> developer tools ,Chrome中的Tools --> developer tools )并隔离列表中应用的CSS。

Also the combo-box will not be rendered as <option> . 此外,组合框也不会呈现为<option> It should be rendered as an unordered list ( <ul><li>...</li> ) 它应该呈现为无序列表( <ul><li>...</li>

If it is indeed list bullet items you can try putting !important in the style to make sure that there is no list style applied. 如果确实是列表项目符号项目,则可以尝试在样式中添加!important ,以确保未应用任何列表样式。

.ComboBoxStyle .ajax__combobox_itemlist
{
    border: 1px solid YellowGreen;
    font-size: medium;
    font-family: Courier New;
    padding-left: 0px;
    list-style-type: none !important; /* Add the important here */
}

I can't reproduce your issue but you must have some sort of css style being applied to ul or li tags that is causing this. 我无法重现您的问题,但是您必须将某种CSS样式应用于导致此问题的ul或li标签。 I know you mentioned you unchecked all the styling on the control in the browser but there must be something you missed. 我知道您提到过您取消选中浏览器中控件的所有样式,但是肯定有某些内容您错过了。

Hopefully this works. 希望这行得通。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM