1
Answer

how to get dropdownlist and label ids from listview to java

<script>

function getmodel()

{
var SelectedText = DropdownList.options[DropdownList.selectedIndex].text;
var lblunitcost = document.getElementById('<%=lblunitcost.ClientID %>');
var sValue = SelectedText;
lblunitcost.innerHTML = sValue;
}

</script>

<div >

<asp:ListView ID="lstViewProducts" runat="server" GroupItemCount="1" OnItemDataBound="lstViewProducts_ItemDataBound" DataKeyNames="ProductID" >
<grouptemplate>
<div id="itemPlaceholderContainer" runat="server" >
<div id="itemPlaceholder" runat="server"></div>
</div>
</grouptemplate>
<itemtemplate>
<span class="unit-cost">Rs.<asp:Label ID="lblunitcost" runat="server"></asp:Label></span>
<asp:DropDownList ID="ddlmodel" runat="server" AutoPostBack="true" onchange="getmodel();">
</asp:DropDownList>


</itemtemplate>

<layouttemplate>
<div>
<div id="groupPlaceholderContainer" runat="server">
<div id="groupPlaceholder" runat="server"></div>
</div>
</div>
</layouttemplate>

</asp:ListView>

</div>


Answers (1)