I want to use DropDownList selectedIndexChanged event without auto postback.
Can I?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Joginder BangerRank #360 · 7K reputationPosted Nov 6, 2014, 10:45 PM EST
Vikram AgrawalRank #4,713 · 329 reputationPosted Nov 6, 2014, 11:28 PM EST
Hi Tin Gyi,
There is many way to solve any problem and one of them is following
you can do it with the help of javascript also
you can write it on "onchange" event of DropDownList
see the following example......
HTML:
<asp:DropDownList ID="DropDownList1" runat="server" onchange="display('DropDownList1');">
<asp:ListItem Value="Item1">asp:ListItem>
<asp:ListItem Value="Item2">asp:ListItem>
<asp:ListItem Value="Item3">asp:ListItem>
<asp:ListItem Value="Item4">asp:ListItem>
<asp:ListItem Value="Item5">asp:ListItem>
asp:DropDownList>
<asp:Label ID="Label1" runat="server" Text="">asp:Label>
JavaScript:
<script type="text/javascript">
function display(id) {
var ddl = document.getElementById(id);
var label = document.getElementById('Label1');
label.innerHTML = 'You have selected : ' + ddl.value;
}
script>
please mark it as accepted if it is helpful to you...
Munesh SharmaRank #174 · 13.9K reputationPosted Nov 6, 2014, 10:58 PM EST
Something like this (don't forget the script manager)