list循环取值

该博客介绍了如何在页面加载后,根据用户选择的机种利用jQuery从后台C#控制器获取绑定的点检项目值,并替换页面上相同点检项目的现有值。内容包括页面HTML结构、控制器操作及逻辑处理代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

实现选择机种后获取机种绑定的点检项目值,替换相同点检项目的点检值
在这里插入图片描述
效果
在这里插入图片描述
页面代码

@model SpotCheckInfo
@{
    ViewBag.Menu = "保养校验-设备点检-点检数据录入";
}
<div class="banner-title">
    @ViewBag.Menu
</div>

@using (Html.BeginForm("PointDataEntry", Html.ControllerName()))
{
    <div>
        <div class="content-body">
            <table class="table">
                <tbody>
                    <tr>
                        <td style="text-align:right"> @Html.LabelFor(m => m.LineName):</td>
                        <td>
                            @(Html.Kendo().DropDownListFor(m => m.LineName)
                                      .DataTextField("Text")
                                      .DataValueField("Value")
                                      .DataSource(ds => ds
                                      .Read(read => read.Action("GetLines", "MeasPoint").Type(HttpVerbs.Post))
                                      )
                                      .HtmlAttributes(new { style = "width: 88%" })
                                      .Filter("contains")
                                      .OptionLabel(Resource.请选择)
                            )
                            @Html.ValidationMessageFor(m => m.LineName)
                            <label style="color:red">*</label>
                        </td>
                        <td style="text-align:right">@Html.LabelFor(m => m.WorkCenter):</td>
                        <td>
                            @(Html.Kendo().DropDownListFor(m => m.WorkCenter)
                                                                        .DataTextField("Text")
                                                                        .DataValueField("Value")
                                                                        .DataSource(ds => ds
                                                                        .Read(read => read.Action("GetWC", "MachineManage").Type(HttpVerbs.Post))
                                                                        )
                                                                        .HtmlAttributes(new { style = "width: 88%" })
                                                                        .Filter("contains")
                                                                        .OptionLabel(Resource.请选择)
                            )
                            @Html.ValidationMessageFor(m => m.WorkCenter)
                            <label style="color:red">*</label>
                        </td>
                        <td style="text-align:right">@Html.LabelFor(m => m.MachineCode):</td>
                        <td>
                         @Html.Kendo().TextBoxFor(m => m.MachineName)
                         @Html.ValidationMessageFor(m => m.MachineName)
                         <label style="color:red">*</label>
                        </td>
                        @*<td class="table-dataCol">
                            @(Html.Kendo().DropDownListFor(m => m.MachineName)
                                                                                            .DataTextField("Text")
                                                                                            .DataValueField("Value")
                                                                                            .DataSource(dataSource => dataSource
                                                                                            .Read(read => read.Action("GetDJMachineList", Html.ControllerName()).Type(HttpVerbs.Post).Data(""))
                                                                                            ).Value(Model.Machine_Id.ToString())
                                                                                            .Events(e => e.DataBound("changeMachineName"))
                                                                                            .HtmlAttributes(new { style = "width: 90%" })
                        )
                            @Html.ValidationMessageFor(m => m.MachineName)
                            <label style="color:red">*</label>
                        </td>*@
                    </tr>
                    <tr>
                        <td style="text-align:right">@Html.LabelFor(m => m.ModelName):</td>
                        <td>
                            @(Html.Kendo().DropDownListFor(m => m.ModelName)
                                                             .DataTextField("Text")
                                                            .DataValueField("Value")
                                                            .DataSource(ds => ds
                                                           .Read(read => read.Action("GetParam", "ESDStandard").Type(HttpVerbs.Post).Data("getParam('Product')"))
                                                           )
                                                           .HtmlAttributes(new { style = "width: 88%" })
                                                           .Filter("contains")
                                                           .OptionLabel(Resource.请选择)
                            )
                            <label style="color:white">*</label>
                        </td>
                        <td style="text-align:right">@Html.LabelFor(m => m.TerminalName):</td>
                        <td>
                            @(Html.Kendo().DropDownListFor(m => m.TerminalName)
                                                       .DataTextField("Text")
                                                      .DataValueField("Value")
                                                      .DataSource(ds => ds
                                                     .Read(read => read.Action("GetParam", "ESDStandard").Type(HttpVerbs.Post).Data("getParam('Terminal')"))
                                                     )
                                                     .HtmlAttributes(new { style = "width: 88%" })
                                                     .Filter("contains")
                                                     .OptionLabel(Resource.请选择)
                            )
                            <label style="color:white">*</label>
                        </td>
                        <td style="text-align:right">@Html.LabelFor(m => m.FilesName):</td>
                        <td>
                            <div class="demo-section k-content">
                                <input name="files" id="files" type="file" />
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

        <div id="editObtSpot">
            <div style="text-align:right;">
                <button type="button" class="k-button k-primary" style="width: 120px;" onclick="sub()">获取点检项目</button>
            </div>
            @(Html.Kendo().Grid<EMS.Models.SpotCheckInfo>()
                    .Name("grid_Spot")
                    .Columns(columns =>
                    {
                        //columns.Bound(c => c.WorkCenter).Width(120);
                        columns.Bound(c => c.LineName).Width(80).Hidden(true);
                        columns.Bound(c => c.MachineCode).Width(80);
                        columns.Bound(c => c.MachineName).Width(80);
                        columns.Bound(c => c.OperationName).Width(100);
                        columns.Bound(c => c.Unit).Width(40);
                        columns.Bound(c => c.StdRange).Width(120); //标准范围
                        columns.Bound(c => c.CHECK_VALUE).ClientTemplate("#= operation(Id,OperationAction) #").Width(40).Filterable(false);
                        // columns.Bound(x => 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值