.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Disable DropDownList using Javascript

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :ASP.Net

I need to diable a DropDownList when a CheckedBox is checked.Both the controls are on Content Page. How can I achieve this using Javascript? 

Any help would be appreciated!!

View Complete Post

More Related Resource Links

Mission Impossible? Use Javascript to Disable a Multi-Line Rich Text Field


Hey Community,

Here's a tough one that I have struggled with and so far have not been able to find an answer for - how do you use Javascript to disable a multi-line rich text field.  I have customized a SP Edit form by adding a CEWP.  In the CEWP I have added the Javascript below (only a partial code sample provided) to disable several fields in the form.  The code works fine for single line text fields but it does not work for multi-line rich text fields.  Any suggestions?

<script language="javascript">
//This runs the function when the form first loads

//This locks the fields the users should not modify
function lockFields()
  var theInputTFTitle = getTagFromIdentifierAndTitle("Input","TextField","Title");
  theInputTFTitle.readOnly = true;
  theInputTFTitle.style.color = 'gray';
  //alert(" Value: " + theInputTFTitle.value);//for testing

   var theInputDDLReplyStatus = getTagFromIdentifierAndTitle("select","DropDownChoice","Reply Status");
  theInputDDLReplyStatus.disabled = true;
  //alert(" Value: " + theInputDDLReplyStatus.value);//for testing

  var theInpu

dropdownlist javascript change items


I can't find solution for this problem for very long time:

I have dropdownlists in Gridview. I need to dinamicly change content of dropdown on client with javascript. Ok, I know to do that. But the problem is when I send data to server changes in dropdownlist does not see. On server I have  old items. How can I change items in dropdown on client with javascript and than see that items on sever when postback data?


How to conditionally Enable/Disable Button control using JavaScript ?

hi all... i have a Button control & a TextBox control on my web page. The Button control is initially Disabled. I want that while typing into TextBox, when the length of the contents of TextBox reaches to 12 (i.e. when i type 12th character), the Button Control should be Enabled & if the length again comes down to less than 12, the Button control should again be Disabled... How can i do this using JavaScript...?? Does anyone know how to do this...?? Please help. It's urgent... Thanx in advance to all posts !

Validating DropdownList Inside Gridview Using Javascript

hi All,      I have Gridview with Dropdownlist which contains data as {select,1,2,3} .Gridview contains multiple rows of data.Submit button is also on form but outside gridview. If any of the rows of gridview dropdownlist contain value as "Select" and click Submit button ,give message as "Please select value". I want to do this stuff using javascript. Thanks in advance.

Javascript to disable MaskedEditExtender

Hi all, can anyone show me how to use javascript to disable maskededitextender? I have a province/state dropdownlist which has all the canadian provinces+US states + australian provinces. The postalcode/state mask for canadian province is 'L9L 9L9' and the postalcode/state mask for US state is '99999-9999' while austrialian province should have no mask at all.  So far i'm able to change the mask properly when the user selects a canadian province or an US state but i don't know how to use javascript to disable the maskededitextender when the user selects an Austrialian province. Any help is appreciated. Thanks!

Get the Dropdownlist text and value using Javascript from client side

Hi, I am encountering a problem about how to get the Dropdownlist text and value using Javascript from client side. I am using C# in Visual Studio 2005 and Javasript . The example codes are like: ( In this example code, I would like to access the text and value of the DropDownListReports in the run() function of Javascript. How can I do that? Any ideas? Thanks a lot. ) protected void Page_Load(object sender, EventArgs e) {              if (!Page.IsPostBack)               {                     DropDownListReports.Items.Clear();                     ListItem listItem = new ListItem();                     listItem.Text = "aText";                     listItem.Value = "aValue;                     DropDownListReports.Items.Add(listItem);         &nbs

disable a single intem in dropdownlist or stop the ddl change event for a single item


hello guys,

I am trying something apart of my boundries, is there any way to disable a single intem in dropdownlist or stop the ddl change event for a single item.

any feadback would be appriciable.

Thanks and Regards

Inderjeet Singh Khalsa

Disable copy paste in textbox without Javascript




Can you somebody help me in disabling copy paste in the textbox without using Javascript for an web application?




Items added through Javascript to a dropdownlist are not accessible through code behind


Hi All,

I am successfully able to add new items to a drop down list using Javascript.

The script I am using is 

        function FillJavaScriptValues() {
            var ddlDeliveryVan;
            ddlDeliveryVan = document.getElementById("DropDownList1");
            var opt = document.createElement("option");

Need help to populate dropdownlist using Javascript


Hi, I'm doing a simple HTML form, that requires two dropdownlist - one that populates the month, and the other to populate the dates based on the month. For example, in January, there are 31 days. So the "date" dropdownlist will populate 1-31 in the "month" dropdownlist. The "date" dropdownlist will change to 1-28 for February when selected and so on...  Can someone please help me with the javascript section? I'm coding using javascript.

Many Thanks!


<title>Test Form</title>
<script language="JavaScript">
function testDate(){

var MonthDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var count = 0;
 if(location.href = document.form1.month.options[document.form1.month.selectedIndex].value) {
  for(var i=1; i<=(MonthDays[count]); i++) {
   document.writeln('<option value="'+i+'">' + i + '</option>');



<form id="form1" name="form1" method="GET">
  <label>Post Reminder:<br />
  <input type="text" width

Dynaimicaly create dropdownlist - Javascript


Hi to all,

I have a web page default.aspx while loading this page i create dropdownlist dynamicaly by using Javascript, my doubt is now i want to write some java script code during the dropdownlist selected Index changed event, how to write it, this is possible if we design the controls at design time but i create it by runtime so anybody tell me how to write the event of the dropdownlist.?

Thanks in advance.

Is it possible to disable all javascript functions which are set to work after a certain time, after


Is it possible to disable all javascript functions which are set to work after a certain time, after update panel asynchronous postback

as you alread know you can set certain functions to get executed after a certain time with setTimeout method

i want to disable all setTimeout method setuped functions after update panel asynchronous postback

is this possible

thank you

disable button in page load click event using javascript



i have button its  enable false in aspx page, if i click the page load  click event  then button should enable

looking forward the reply.

Javascript Disable on Enter key not working?


Hi, I have a weird little problem here with a form login page.  I'm building on top of some other code, so it's a bit hack and slash, but what I want at this point is just to disable the Enter key.  I use javascript and it does work, the enter key stops working. 

UNLESS the mouse cursor is in the password textbox, then hitting enter triggers a form submit. 

Any idea why this is happening? Or how I can redirect the enter click?  Right now everything I seem to try just results in a form submit.



Disable Browser Back Button Using Javascript ASP.NET


 Hi... Am using following script, disable back browser, it works well, only in Chrome, if i try ie it says .. Webpage has expired,   any simple method is there? but it should suitable for browsers !

<script type = "text/javascript" >
    function disableBackButton() {
    setTimeout("disableBackButton()", 0);

<body onunload="disableBackButton()">
Protected Overloads Overrides Sub OnPreRender(ByVal e As EventArgs)
        Dim strDisAbleBackButton As String
        strDisAbleBackButton = ""
        ClientScript.RegisterClientScriptBlock(Me.Page.[GetType](), "clientScript", strDisAbleBackButton)
End Sub

ASP.NET, HTML, JavaScript Snippet Support (VS 2010 and .NET 4.0 Series)

This post covers another useful improvement in VS 2010 - HTML/ASP.NET/JavaScript snippet support. Snippets allow you to be more productive within source view by allowing you to create chunks of code and markup that you can quickly apply and use in your application with a minimum of character typing.

Visual Studio has supported the concept of "snippets" for VB and C# in previous releases - but not for HTML, ASP.NET markup and JavaScript. With VS 2010 we now support snippets for these content types as well.

call JavaScript - jQuery code from ASP.NET Server-Side

jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend