Can you provide guidance on how to access the value of a dropdownlist labeled [ddrateplan] in the following JavaScript code? The dropdown is situated within the gridview [DataExtensionList].
<asp:GridView ID="DataExtensionList" Width="100%" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField HeaderText="Service No.">
<ItemTemplate>
<asp:HiddenField ID="hdid" runat="server" Value='<%#Eval("tran_id") %>' />
<asp:DropDownList ID="drpphn" runat="server" CssClass="form-control" AutoPostBack="true"
OnSelectedIndexChanged="drpphn_SelectedIndexChanged" SelectedValue='<%# Eval("phone_no") %>'>
<asp:ListItem Value="0">Existing no</asp:ListItem>
<asp:ListItem Value="1">New no</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtservicenumber" runat="server" Text='<%#Eval("service_number") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Rate Plan">
<ItemTemplate>
<asp:DropDownList ID="ddrateplan" runat="server" CssClass="form-control" AutoPostBack="true" onchange="mul();"
OnSelectedIndexChanged="ddrateplan_SelectedIndexChanged"
Style="margin: 0 !important; padding: 0 !important;" SelectedValue='<%# Eval("rate_plan") %>'>
<asp:ListItem Value="0">Select Rate Plan</asp:ListItem>
<asp:ListItem Value="35">p35</asp:ListItem>
<asp:ListItem Value="59">p59</asp:ListItem>
<asp:ListItem Value="89">p89</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address">
<ItemTemplate>
<label>
<asp:TextBox ID="txt_address" AutoPostBack="true" runat="server" Text='<%# Eval("address")%>'></asp:TextBox>
</label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
I attempted to use the following JavaScript example, but encountered issues...
<script type="text/javascript">
function mul() {
var gv = document.getElementById("<%=DataExtensionList.ClientID %>");
var dropvalue = gv.getElementsByTagName('ddrateplan');
var rowcount = document.getElementById('<%=DataExtensionList.ClientID%>').rows.length;
var textmonth = document.getElementById('<%=txtcontactperiod.ClientID%>').value;
var total = 0;
for (var i = 0; i < rowcount - 1; i++) {
total += parseInt(dropvalue) * parseInt(textmonth)
}
if (textmonth > 0) {
$("<%=hdvalue.ClientID%>").val(total);
document.getElementById('<%=txttotalpayble.ClientID%>').value = total;
}
else {
$("<%=hdvalue.ClientID%>").val("");
document.getElementById('<%=txttotalpayble.ClientID%>').value = '';
}
}
</script>