Hi I have a dropdownlist, I am selecting its valus from server side code. I don't want to allow user to change it. Means He must not be able to change it neither by mouse click and not by keyboard. I want to handle it from Client Side. Please suggest only javascript methods.
Asked
Active
Viewed 1,251 times
0
-
Just disable the dropdown from client side. – Usman Khalid Feb 26 '14 at 11:07
-
possible duplicate of [How to make html – Asons Feb 26 '14 at 12:24
2 Answers
0
Try it:
Jquery:
$(document).ready(function() {
$("#dropdounid").prop("disabled", true);
});
OR
$(document).ready(function() {
$("#dropdounid").attr("disabled", true);
});
OR
Javascript
you can disable Asp.net DropDownList
using below code in javascript at client side.
document.getElementById('<%=txtActualWindSpeed.ClientID%>').disabled = true;
Edit
you can put this code inside of head tag or body tag
.
<head>
<script>
document.getElementById('<%=txtActualWindSpeed.ClientID%>').disabled = true;
</script>
</head>
I hope it will helpful to you.

Govinda Rajbhar
- 2,926
- 6
- 37
- 62
-
for which client side event I should write this piece of code. This is big concern for me. – user3264676 Feb 26 '14 at 11:35
-
if you don't want to allow user to change `dropdown` then you can keep this code in your source code `` – Govinda Rajbhar Feb 26 '14 at 11:38