Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to change the read only property of a html input type text dynamically for different condition.I have used code
C#
txtCustomerID.Style.Item("readonly") = " "


But its not working. What will be exact code? I need the code in vb.
Posted
Updated 24-Aug-10 2:12am
v3

To add readonly attribute in html input control
VB
txtCustomerID.Attributes.Add("readonly", "readonly")

To remove
VB
txtCustomerID.Attributes.Remove("readonly")
 
Share this answer
 
Comments
Rounak Hasan 24-Aug-10 8:21am    
Reason for my vote of 5
its working f9.......
Try the following:

For setting attribute:

document.getElementById("txtCustomerID").setAttribute("readonly", "readonly");


For removeing attribute:

document.getElementById("txtCustomerID").removeAttribute("readonly");
 
Share this answer
 
Comments
Rounak Hasan 24-Aug-10 7:14am    
I need the code in vb not in javascript....................
Rounak Hasan 24-Aug-10 8:14am    
Reason for my vote of 1
I have asked the code in vb.......
Al-Farooque Shubho 24-Aug-10 8:45am    
Oh..sorry boss. I missed the word "VB". My apology. I just wanted to help.
You wrote "Html input type text" and hence I didn't think about the server-end code (VB or C#)
Good to see you getting the answer already.

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