Click here to Skip to main content
15,896,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi how to show disabled textbox when dropdonws selected item is comepleted.?can any one suggest me?
Posted
Comments
Dinesh Mani 13-Feb-12 5:19am    
Do you mean when the server event is complete?
ythisbug 13-Feb-12 5:30am    
yea.

Try this
C#
if(DropDown.SelectedText == "Completed")
     textbox.ReadOnly=true;


OR

textbox.Enabled=false;
 
Share this answer
 
v2
 <script type="text/javascript"> function changetextbox() 
{     if (document.getElementById("ddl").value === "noy")
 {         document.getElementById("txt").disable='true';     } 
else {         document.getElementById("txt").disable='false';     }
 } 
</script> 

<select id="ddl" name="ddl" onChange="changetextbox();"> 
    <option>Yes</option>     <option>No</option>
     <option>No, but planning in future</option> </select>
  <input type="text" name="txt" id="txt" /> 
 
Share this answer
 
v3
C#
if(dropdonws.SelectedItem.Text=="Completed")
{
textBox.ReadOnly=true;
}

or
C#
if(dropdonws.SelectedItem.Text=="Completed")
{
textBox.Enalbed=false;
}
 
Share this answer
 
Comments
ythisbug 13-Feb-12 5:17am    
m getting error for this both solution

Error 9 'System.Web.UI.WebControls.TextBox' does not contain a definition for 'Enalbed' and no extension method 'Enalbed' accepting a first argument of type 'System.Web.UI.WebControls.TextBox' could be found (are you missing a using directive or an assembly reference?)
Syed Salman Raza Zaidi 13-Feb-12 5:39am    
its Enabled not Enalbed, are you not using Visual Studio???
ythisbug 13-Feb-12 5:54am    
using vb ..bt its not working..i gave enabled only..error nt der..
07navneet 13-Feb-12 5:39am    
check the spelling "enabled" not "enalbed"
ythisbug 13-Feb-12 5:53am    
ya enabled only..but its not working..
C#
if(dropdonws.SelectedItem.Text=="Completed")
{
textBox.disabled=false;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900