User283571144 posted
Hi brucey,
Hi folks, how do you set a default text value"Please select Menu Type" when pre populating a dropdown from code?
As far as I know, you could use jQuery append function add html elements to pre populating a dropdown.
More details, you could refer to follow codes:
<head runat="server">
<script src="jquery-1.7.1.js"></script>
<title></title>
<script>
$(function () {
$("#DropDownList1").append($('<option></option>').val('Menu1').html('Please select Menu'));
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
</div>
</form>
</body>
Best Regards,
Brando