Click here to Skip to main content
15,906,097 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
heres my code..

@section Scripts
{
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#Receipt").change(function () {
$("#idSelected").val = true;
$.post("~/PaymentPaid/Create", "ReceiptId");
});
});

</script>
}

html code..


@Html.HiddenFor(Model=>Model.idSelected,new{id="idSelected"})


@Html.DropDownList("ReceiptID", PaymentPaidViewModel.RmorderReceiptid(), "Select OrderID", new { id="Receipt"})
@Html.ValidationMessageFor(model => model.RMOrderReceiptId)
Posted

Try this,
C#
$("#idSelected").val('true');
 
Share this answer
 
v2
HTML
$('#dropdownID').val("selected Value ");

Refer this
How to set a dropdown box value in jQuery[^]
 
Share this answer
 
Comments
FirdousNasreen 16-Jul-13 20:16pm    
Thank You for answering
Naz_Firdouse 17-Jul-13 2:14am    
Mark as Answer and vote up so that it will be useful for others
You can set element in dropdown by its value.
$("#ddlList").val(1);

OR you can also set via selected index.
$("#ddlList").get(0).selectedIndex = 3;

Refer this:
Common Dropdown operation (Get, Set, Add, Remove) using jQuery[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900