how get value of input in view of mvc
I set value id_dep like this
<input type="hidden" id="id_dep" />
<script>
$( "#id_department" ).change(function() {
var selectedValue = $(this).val();
$("#id_dep").val(value)
});
</script>
so how i use from value in this part
@{
var dep = id_dep.value;
tbl_poudman[] poudmans = (from x in db.tbl_poudman where x.id_department == dep select x).ToArray();
foreach (tbl_poudman poudman in poudmans)
{
string selected = "";
if (IsPost)
{
if (poudman.id == int.Parse(Request["id_poudman"]))
{
selected = "selected";
}
}
@: <option value="@poudman.id" @selected>@poudman.poudman_name</option>
}
}