Link to home
Start Free TrialLog in
Avatar of solution1368
solution1368

asked on

auto complete multiple columns

Either using ajax, jquery for the auto complete function for the text box. Instead of shown e.g. 50 US states in one long columns.

How can it be coded with like 5 columns so the drop down list will be shortened.

I have asp.net / c#. Thanks,
Avatar of sivagnanam chandrakanth
sivagnanam chandrakanth
Flag of India image

The div on which you are showing the ajax suggestions, wrap the text after certain lines for example 5 lines..

In other words,

Your Div should be styled to show the suggestions in multiple columns like this

Suggestion1     Suggestion4       Suggestion7
Suggestion2     Suggestion5       Suggestion8
Suggestion3     Suggestion6       Suggestion9
Avatar of Alexandre Simões
Have a look at this example I built for you to see if it's what you need:
http://jsfiddle.net/7Lsy6/1/

Basically I took a sample code from jQueryUI AutoComplete and just added a small CSS change:
.ui-menu-item {
    width: 33% !important;
    float: left;
}

Open in new window


Just run the example and let me know.

Cheers!
Just a comment on the last post - you might want to prefix the css change with a class or ID to keep the change local to the text box.

There might not be a side effect in this case but if you do have other situations where you don't want a multicolumn output then the above change will need to be localised to the text box in question.
Avatar of solution1368
solution1368

ASKER

Great but I don't want to see comma after it is selected. Is it possible?
And if the data actually come from SQL db. How to do it in asp.net c#?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Alexandre Simões
Alexandre Simões
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
alex: very helpful. I am glad to have your helps.