I am developing a application in which I bind some value with value from data base like below.
<asp:DropDownList ID="ddlcheck" runat="server" Width="95%"
Style="vertical-align: bottom;">
<asp:ListItem value="--Select--" selected="True" >--Select--</asp:ListItem>
<asp:ListItem value="0,2.00,0.07,1.90,0.50,0.00,0.00,0.00">Pc/asp:ListItem>
<asp:ListItem value="1,102.30,82.20,86.50,85.20,5000016344967.00,0.00,0.00">Server</asp:ListItem>
</asp:DropDownList>
Now here I want to split these value but can’t success following my code
function PutData() {
var sel = $('# ddlcheck');
for (var i = 0; i < sel.options.length; ++i) {
if (sel.options[i].selected == true) {
var setaccudccode = new Array();
var setall = new Array();
setall = sel.options[i].value.split(',');
$("[id*=Label1]").innerHTML = setall[0] $("[id*=Label2]").innerHTML = setall[1];
$("[id*=Label3]").innerHTML = setall[2];
$("[id*=Label4]").innerHTML = setall[3];
$("[id*=Label5]").innerHTML = setall[4];
$("[id*=Label6]").innerHTML = setall[5];
}
}
}
Here I split the value and show into label my html code
<div>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</div>
<div>
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
</div>
<div>
<asp:Label ID="Label3" runat="server" Text=""></asp:Label>
</div>
<div>
<asp:Label ID="Label4" runat="server" Text=""></asp:Label>
</div>
<div>
<asp:Label ID="Label5" runat="server" Text=""></asp:Label>
</div>
<div>
<asp:Label ID="Label6" runat="server" Text=""></asp:Label>
</div>
Here I call this code on dropdown change.
this. ddlcheck.Attributes.Add("onchange", string.Format("PutData()"));
I am to split the data but going failed please help me to solve that problem using jquery.