E
E
hi,
I am having trouble getting the value of a dropdownlist from javascript.
I have a form that contains a user control that has a drop downlist.
the usercontrol is declared as follows:
protected frm3H_1 Frm3H_11;
in the user control I declare the dropdownlist
protected System.Web.UI.WebControls.DropDownList lstdirectorindirectownership;
there is some javascript included in the form that is trying to access the
value of the dropdownlist.
I placed this in my usercontrol ascs file.
<tr>
<td><span class="bodytext">
<asp:dropdownlist id="lstdirectorindirectownership" runat="server"
Width="92px">
<asp:ListItem Value="1">D</asp:ListItem>
<asp:ListItem Value="0">I</asp:ListItem>
</asp:dropdownlist></span></td>
</tr>
In the javascript I am trying to get it by the following.
var selectedIndex =
document.table1.Frm3H_11_lstdirectorindirectownership.selectedIndex
alert("Selected Index is " + selectedIndex);
var selectedValue =
document.table1.Frm3H_11_lstdirectorindirectownership[selectedIndex].value;
alert("Selected Value is \'" + selectedValue + "\'");
It does not seem to work. Can anyone provide some insight to what I should
be doing?
I am having trouble getting the value of a dropdownlist from javascript.
I have a form that contains a user control that has a drop downlist.
the usercontrol is declared as follows:
protected frm3H_1 Frm3H_11;
in the user control I declare the dropdownlist
protected System.Web.UI.WebControls.DropDownList lstdirectorindirectownership;
there is some javascript included in the form that is trying to access the
value of the dropdownlist.
I placed this in my usercontrol ascs file.
<tr>
<td><span class="bodytext">
<asp:dropdownlist id="lstdirectorindirectownership" runat="server"
Width="92px">
<asp:ListItem Value="1">D</asp:ListItem>
<asp:ListItem Value="0">I</asp:ListItem>
</asp:dropdownlist></span></td>
</tr>
In the javascript I am trying to get it by the following.
var selectedIndex =
document.table1.Frm3H_11_lstdirectorindirectownership.selectedIndex
alert("Selected Index is " + selectedIndex);
var selectedValue =
document.table1.Frm3H_11_lstdirectorindirectownership[selectedIndex].value;
alert("Selected Value is \'" + selectedValue + "\'");
It does not seem to work. Can anyone provide some insight to what I should
be doing?