TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mayur Gujrathi
410
3.9k
1m
How to select multiple/all items in listbox
Aug 23 2011 5:15 AM
I have a list box like this
<select id="ddlBranch" name="ddlBranch" multiple runat="server" style="width:100%;">
</select>
in this listbox there are no of items
on blur of textbox i am fetching some values from database
I need whatever items i am retrieving matching with listbox should be all selected in list box
with the help of following script i am getting able to selected only one value from listbox
function getSelet()
{
if (document.getElementById('hidBranchLst').value != '') {
var strBranch = document.getElementById('hidBranchLst').value
var strBranchList = strBranch.split('|');
var MulSel = document.getElementById('ddlBranch');
MulSel.multiple = true;
for (var j = 0; j < strBranchList.length; j++) {
alert(strBranchList[j].toString());
for (var i = MulSel.options.length - 1; i >= 0; i--) {
if (MulSel.options[i].value == strBranchList[j].toString()) {
MulSel.selectedIndex = i;
}
}
}
}
}
Reply
Answers (
1
)
webbrowser control login problem
Pivot Chart in Excel using C#