<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DemoGrid.Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script src="Scripts/jquery-1.11.2.min.js"></script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<script type="text/javascript">
$(document).ready(function () {
$("select#DropDownList1 option").filter(function () {
return $(this).val() == "0";
}).prop('selected', true);
});
</script>
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="0">Select</asp:ListItem>
</asp:DropDownList>
<asp:Button runat="server" Text="dummy" />
</div>
</form>
</body>
</html>
Tuesday, 13 January 2015
Select Default Option in DropDownList on PageLoad in ASP.Net using jQuery
Labels:
ASP.NET
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment