gibi göstermek istiyorum. Bundan sonra
<asp:DropDownList ID="ddlyear" runat="server">
<asp:ListItem>Experience</asp:ListItem>
<asp:ListItem>Fresher</asp:ListItem>
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
</asp:DropDownList>
, sen kaldırarak büyü yapmak için jQuery ihtiyaç ve yer tutucu ekleyerek yeniden. jQuery sadece Nuget paket olarak yüklemek veya manuel olarak indirmek, bunu kullan ve aspx bir deklarasyon eklemek için gereken
<script>
var isChanged = false;
$(function() {
$('#ddlyear').focusin(function() {
if (!isChanged) {
// this removes the first item which is your placeholder if it is never changed
$(this).find('option:first').remove();
}
});
$('#ddlyear').change(function() {
// this marks the selection to have changed
isChanged = true;
});
$('#ddlyear').focusout(function() {
if (!isChanged) {
// if the control loses focus and there is no change in selection, return the first item
$(this).prepend('<option selected="selected" value="0">Experience</option>');
}
});
});
</script>
dikkate alın.
<head runat="server">
<title></title>
// Sample only, you can place it in any location or use any version
<script src="../scripts/jquery-2.2.2.min.js"></script>
</head>
tutucudur sadece çünkü ilan ilk seçeneğin gösterir, alışkanlık işi bağlıyor. – DevEstacion
sonra ne işe yarıyor? – amit
benim için çalışıyor .... bir deneyin –