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
r k
NA
111
16.7k
Html select option Multi select option
Apr 17 2021 1:40 AM
I tried all the methods with hard-coded ,the values i am getting selected for options highlighted, but when i replace hard coded value with hidden values (actual user pre selected values from the database )
it just shows /high light the first value
Please help this is urgent.
below is my code:
$(
function
() {
var
hdnvalues =
""
;
if
($.trim($(
'#<%=hfroles.ClientID %>'
).val() !=
""
))
{ hdnvalues = $.trim($(
'#<%=hfroles.ClientID %>'
).val()); }
var
values =
"1,2,3"
;
// var values = hdnvalues;
$.ajax({
type:
"POST"
,
url:
"NotificationsNews.aspx/GetRoles"
,
data:
'{}'
,
contentType:
"application/json; charset=utf-8"
,
dataType:
"json"
,
success:
function
(r) {
var
ddlRoles = $(
"[id*=ddlRoles]"
);
$.each(r.d,
function
()
{
ddlRoles.append($(
"<option></option>"
).val(
this
[
'Value'
]).html(
this
[
'Text'
]));
$.each(values.split(
","
),
function
(i, e) {
$(
"#ddlRoles option[value='"
+ e +
"']"
).prop(
"selected"
,
true
);
});
});
}
});
});
Reply
Answers (
2
)
Delete Uploaded Image After Sending An Email
How to get xml documnet columns data types in c#