Sorry for the basic silly question. But I really dont have any idea on how to solve this. I have ASP controls (One TextBox
and One DropDownList
). Now I need to access value
property of TextBox
as well as SelectedIndex
property of DropDownList
. This should be as simple as:
For TextBox
:
document.getElementById("<%= myControl.ClientID >").value
For DropDownList
:
document.getElementById("<%= myControl.ClientID %>").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.
HTML Code:
<div> <asp:TextBox ID="myText" runat="server" /> <asp:DropDownList ID="myList" runat="server" /> </div>
Is there any other way or I am just missing something here?