0

i want to change the default value of dropdown list to 0 i.e selected index value shud become 0 when press the cancel button so that watever i selected previously is removed

here is the javsacript

function CloseDiv() {
            var control = document.getElementById("divReqStages");
            control.style.visibility = "hidden";
            
                  var control1 = document.getElementById('DDLReqStages').selectedIndex;
                    
      control1.value='0';
         
        }

here s asp.net code

<input type="button" name="btnCancel" style="font-size: xx-small" onclick="JavaScript:CloseDiv();" value="Cancel" />
2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by hielo
0
function CloseDiv() {
            var control = document.getElementById("divReqStages");
            control.style.visibility = "hidden";
            
            document.getElementById('DDLReqStages').selectedIndex=0;
         
        }
0

The above will select the first OPTION in the SELECT list. IF you want NO option selected, then use -1 instead of zero

0

Thanks for ur advice but its still not working...the option which i selected and then cancelled is selected if i open the drop downlist

0

.the option which i selected and then cancelled is selected if i open the drop downlist

I don't understand what you are describing. IF you have a link to a test page or a copy of your code, it might make help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.