stevenjin 2023-02-23 23:41 采纳率: 98.2%
浏览 37
已结题

在一个视图中提交选择的选项卡table内容到后台

有如下选项卡,每次选择的是第二个。但提交到后台,始终是第一个选项卡(Temperature)中的model
1.前台


<form id="main" method="post" data-ajax="true" data-ajax-success="afterSuccess" action="/Controls/Update">
    <div class="row" style="color:#007A7c;font-size:20px;">
        <div class="col-md-7" style="margin-top:90px">
            <h4 class="text-left"> Settings</h4>
            <!-- Nav tabs -->
            <ul class="nav nav-tabs navbar-expand-sm bg-light" role="tablist">
                <li class="nav-item">
                    <a class="nav-link " data-bs-toggle="tab" href="#Temperature"><h5>Temperature</h5></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link active" data-bs-toggle="tab" href="#Level"><h5>Level</h5></a>
                </li>      
            </ul>
            <div class="tab-content bg-light">
                <div id="Temperature" class="container tab-pane" style="margin:2px; font-size:20px;">
                    <table class="table table-striped">
                        <tbody>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td style="font-size:20px;color:#008A7D"> Name</td>
                                <td>
                                    <input type="text" value="Stirrer" class="form-control input-group input-group-lg" data-ajax-success="afterSuccess" data-ajax="true" style="font-size:20px;" id="DisplayName" name="DisplayName" />
                                    <input type="hidden" value="2" data-val="true" id="InDepth" name="InDepth" />
                                </td>
                            </tr>
                            <tr>
                                <td style="font-size:20px;color:#008A7D">Unit</td>
                                <td><input type="text" value="rpm" class="form-control input-group input-group-lg" style="font-size:20px;" id="Unit" name="Unit" /></td>
                            </tr>
                            <tr>
                                <td style="font-size:20px;color:#008A7D">Screen Priority(0,65)</td>
                                <td><input type="text" value="12" class="form-control input-group input-group-lg" style="font-size:20px;" data-val="true" data-val-required="The ScreenPriority field is required." id="ScreenPriority" name="ScreenPriority" /></td>
                            </tr>
                            <tr>
                                <td style="font-size:20px;color:#008A7D">Decimals</td>
                                <td><input type="button" value="2" class="form-control input-group input-group-lg" style="font-size:20px;" /></td>
                            </tr>
                            <tr>
                                <td><input type="submit" value="Confirm" class="form-control btn-primary" style="font-size:20px;" /></td>
                                <td><input type="reset" value="Cancel" class="form-control btn-secondary" style="font-size:20px;" /></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div id="Level" class="container tab-pane active" style="margin:2px; font-size:20px;">
                    <table class="table table-striped">
                        <tbody>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td style="font-size:20px;color:#008A7D">Name</td>
                                <td>
                                    <input type="text" value="pH" class="form-control input-group input-group-lg" data-ajax-success="afterSuccess" data-ajax="true" style="font-size:20px;" id="DisplayName" name="DisplayName" />
                                    <input type="hidden" value="0" id="InDepth" name="InDepth" />
                                </td>
                            </tr>
                            <tr>
                                <td style="font-size:20px;color:#008A7D">Unit</td>
                                <td><input type="text" value="" class="form-control input-group input-group-lg" style="font-size:20px;" id="Unit" name="Unit" /></td>
                            </tr>
                            <tr>
                                <td style="font-size:20px;color:#008A7D">Screen Priority[0,65]</td>
                                <td><input type="text" value="10" class="form-control input-group input-group-lg" style="font-size:20px;" id="Unit" name="Unit" /></td>
                            </tr>
                            <tr>
                                <td style="font-size:20px;color:#008A7D">Decimals[0,4]</td>
                                <td><input type="button" value="2" class="form-control input-group input-group-lg" style="font-size:20px;" /></td>
                            </tr>
                            <tr>
                                <td><input type="submit" value="Confirm" class="form-control btn-primary" style="font-size:20px;" /></td>
                                <td><input type="reset" value="Cancel" class="form-control btn-secondary" style="font-size:20px;" /></td>
                            </tr>
                        </tbody>
                    </table>
                </div>                
            </div>
        </div>      
    </div>
</form>

2.后台

 [HttpPost]
        public IActionResult Update(Sensors sensor)
        {

       }
  • 写回答

1条回答 默认 最新

  • m0_65749592 2023-02-24 15:06
    关注

    你是前端要传到后台吗

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 3月7日
  • 已采纳回答 2月27日
  • 修改了问题 2月24日
  • 修改了问题 2月23日
  • 展开全部

悬赏问题

  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题