根据我单击Kendo UI的按钮发送参数

时间:2017-03-16 14:59:45

标签: javascript c# jquery asp.net kendo-ui

我需要将我在主视图中单击(编辑或创建)按钮的参数发送到部分视图(弹出窗口),然后发送控制器的此参数(带来过滤后的列表)

这是我的控制器

public ActionResult docList(string type){
        var business = new mymodelBusiness();

        return Json(from item in business.GetList(Id, UsrId, type)
                    select new SelectListItem
                    {
                        Value = Convert.ToString(item.Id),
                        Text = item.Cod + ", " + item.Nom //+ item.usrNom
                    }, JsonRequestBehavior.AllowGet);
    }

这是我在局部视图(弹出窗口)中需要的下拉列表

    <div class="form-group select-crud col-lg-6 col-md-6 col-sm-6 col-xs-12">
        <p>@Html.LabelFor(m => m.novId)</p>
        @(Html.Kendo().DropDownListFor(p => p.novId)
              .Name("clcList")
              .DataTextField("Text")
              .DataValueField("Value")
              .Filter("contains")
              .DataSource(source =>
              {
                  source.Read(read =>
                  {
                      .Read(read => read.Action(""docList", "myController", new { action = variable });//here's the problem. I don't know how to receive the variable
                  });
              })
              .HtmlAttributes(new { @class = "form-control" })
        )
    </div>

这是我的主要观点,只有网格,我需要aditional数据函数什么东西还没什么呢?

      @(Html.Kendo().Grid<myModel>
        ()
        .HtmlAttributes(new { style = "width:100%;text-align:left" })
        .Name("grid")
        .Columns(columns =>
        {
            columns.Command(command =>
            {
            columns.Bound(c => c.Cod).Width(200);
        })
        .ClientDetailTemplateId("client-template")
        .ToolBar(toolbar =>
        {
        toolbar.Template(@<text>
        <button class='btn btn-success btn-sm k-grid-add' data-toggle="tooltip" data-placement="bottom" title="Create">
            <span class='glyphicon glyphicon-plus'></span>
        </button>            
            <span class="glyphicon glyphicon-book "></span>
        </button>
        </text>);
        })
        .ColumnMenu()
        .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("docCustom").Window(w => w.Width(700)))
        })
        .Events(events =>
        {
            events.Cancel("onCancel");
            events.Remove("onRemove");
            events.Save("onSave");
            events.Edit("onEdit");
            events.DataBound("onDataBound");
        })
        .DataSource(dataSource => dataSource
        .Ajax()
        .Events(events => events.Error("error_handler").RequestEnd("onRequestEnd"))
        .PageSize(10)
        .Model(model => model.Id(p => p.masterId))
        .Read(read => read.Action("AccionRead", "myController"))
        .Create(create => create.Action("AccionCreate", "myController"))
        .Update(update => update.Action("AccionUpdate", "myController"))
        .Destroy(destroy => destroy.Action("AccionDelete", "myController"))
        ).AutoBind(false)
    )

事件onEdit:

        function onEdit(e) {
            //Implement the event handler for Edit
            if (e.model.isNew()) {
                $('.k-window-title').html('New');
                $('.k-grid-update').html('<span class="k-icon k-add"></span> Create');
            }
        }

0 个答案:

没有答案