hoe在局部视图中触发选定的索引更改事件,并将选定的项值传递给相应的操作 [英] hoe to fire selected index change event in partial view and pass selected item value to corresponding action

查看:67
本文介绍了hoe在局部视图中触发选定的索引更改事件,并将选定的项值传递给相应的操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

venture controller:
if (itemVenture.VentureLocationID.Equals(itemLoc.VentureLocationID))
                        {
                             if (!_locationList_1.Contains(itemLoc))
                             _locationList_1.Add(itemLoc);
}
  ViewBag.leftcontent1 = new SelectList(_locationList_1, "VentureLocationID", "VentureLocationName");


         return PartialView(_locationList_1);

in partial view:
@model IEnumerable<Subhagruha.Model.VentureLocation>
 @Html.DropDownList("VentureLocation", new SelectList(Model, "VentureLocationID", "VentureLocationName"), "Projects", new { @id = "VentureLocationID" })
<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        $("#VentureLocation").change(function () {
            $.ajax({
                url: '@Url.Action("Index","Venture")' + this.value,
                data: { id: $('#VentureLocationID').val() },

                dataType: "json",
                type: "Get",
                success: function (response)
                { }
                     });
        });
    });
</script>
i am getting venture location in to dropdownlist but selected index change is not fireing and when i select a venturelocation corresponding venturelocationid should be passed to index action in venture controller

推荐答案

(document).ready(function(){
(document).ready(function () {


(#VentureLocation)。change(function(){
("#VentureLocation").change(function () {


.ajax({
url:'@ Url.Action(Index,Venture)'+ this.value,
data:{id:
.ajax({ url: '@Url.Action("Index","Venture")' + this.value, data: { id:


这篇关于hoe在局部视图中触发选定的索引更改事件,并将选定的项值传递给相应的操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆