jitendra

jitendra

  • 1.3k
  • 430
  • 67.5k

Dropdown list with show data using asp.net mvc4

May 2 2014 11:09 AM
@model Demo19September.Models.EntityModel.TBL_Role

@{
Layout = null;
}

<!DOCTYPE html>

<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>SearchUserByRole</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

<script type="text/javascript">
$(document).ready(function () {
$("#RoleID").change(function ()
{
var ID = $(this).val();
alert(ID);
$.ajax({
type: "Post",
url: '@Url.Action("UserList", "NewUserProfile")',
data: { RoleID: ID },
dataType: "html",
success: function (data)
{
alert(data);
$('#dialog').html(data);
},
error: function (req, status, error)
{
alert(error);
}
});
});
});

</script>
</head>
<body>
<div>

@using (Html.BeginForm())
{
@Html.DropDownListFor(x => x.RoleID, (IEnumerable<SelectListItem>)ViewBag.MilesStoneID, new { @style = "width:200px;" , @class="text ui-widget-content ui-corner-all"})
<hr />
@Html.Action("UserList","NewUserProfile")
}
</div>
<div id="dialog"></div>
</body>
</html>


Answers (1)