Click here to Skip to main content
15,911,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sorry for the basic silly question. But I really dont have any idea on solving this. I have ASP controls (One Text Box and One Drop Down List). Now I need to access value property of TextBox as well as SelectedIndex property of dropdown list. This should be as simple as:
for TextBox:
JavaScript
document.getElementById("<%= myControlID %>").value

for DropDown List:
JavaScript
document.getElementById("<%= myControlID %>").selectedindex

But in Visual Studio 2008, while I am writing these codes, it does not work. I can not find any value or selectedindex attribute for the respective control. I am not getting this, because in most forums and tutorials, they suggested in a simple way I mentioned.

Is there any other way or I am just missing something here? Please help me out. Thanks in advance
Posted
Updated 5-Jan-12 2:34am
v2
Comments
bbirajdar 5-Jan-12 10:03am    
Did you try with.... document.getElementById("<%= myControl.ClientID %>").value

1 solution

try this i think we used single cote(ie ' ') either double (" ")
document.getElementById('<%= myControlID %>').value
 
Share this answer
 
Comments
Jyoti Choudhury 6-Jan-12 1:37am    
I tried double quote, single quote both but still not working..:(

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