Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increasing the width of the autocomplete extender list

I have an ASP.NET AJAX autocomplete extender with CompletionListCssClass=autocomplete_completionListElement :

.autocomplete_completionListElement 
{   
    width:500px;
    margin : 0px!important;
    background-color : inherit;
    color : windowtext;
    border : buttonshadow;
    border-width : 1px;
    border-style : solid;
    overflow :auto;
    height : 200px;
    text-align : left; 
}

But for some odd reason the width of the auto complete list always takes up the width of the textbox even when I set the width to 500px. Is there a way to fix this?

like image 284
Kumar Avatar asked Mar 30 '10 17:03

Kumar


3 Answers

I believe you can also accomplish this by changing

width:500px;

to

width:500px!important;

Tim Mackey expounds more in this blog post. Basically you have to use !important to override the CSS spit out by the control itself.

like image 156
Aaron Daniels Avatar answered Nov 19 '22 03:11

Aaron Daniels


I finally figured it out. I used the OnClientPopulated="onListPopulated" property as follows:

function onListPopulated() {

        var completionList = $find("AutoCompleteEx").get_completionList();
        completionList.style.width = 'auto';
}
like image 9
Kumar Avatar answered Nov 19 '22 02:11

Kumar


You need to set the min-width to 500px

like image 2
rino.batin Avatar answered Nov 19 '22 01:11

rino.batin