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 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程