如何在我的href = "Home/CompletedGrid发送数据?Value = ?????"

How to send data in my href = "Home/CompletedGrid?value = ?????"

本文关键字:quot 数据 Value CompletedGrid 我的 Home href      更新时间:2023-09-26

My View

...header content....
@{
var altRow = false;
    foreach (var item in Model.fNameList)
    {
        <tr>
            <td style ="background-color:@(altRow ? "#fff" : "#E0EBEB"); height:40px;width:100px; padding-left:20px;"><a href ="#" onclick='call("@item.techNo");' style ="text-decoration:none; text-decoration-color:black;"> @item.techNo</a></td>
            <td style ="background-color:@(altRow ? "#fff" : "#E0EBEB"); height:40px;width:200px; padding-left:20px;"> @item.firstName @item.lastName</td>
        </tr> 
        altRow = !altRow;
    }                                                   
}
...content...
 @Html.TextBoxFor(m => m.techNo, new { @class="form-control maintain-text", placeholder="Technician No..."})
...content...
<a id="completed"class="btn btn-default" target="_blank" href="Home/CompletedGrid?value=@*m.techNo*@"><i class='fa fa-check fa-fw'></i>Completed</a>

我想发送我的m。techNo value to my "Home/CompletedGrid? " value=//m。techNo//"但当我尝试它没有工作,甚至它的@Model。techNo值仍然为NULL。我如何发送我的值techNo到我的Home/CompletedGrid?techNo@,我需要改变我的剃刀还是我应该在我的脚本中添加一些东西。

我脚本

function call(x) { $("#techNo").val(x); }

我只需要转移target="_blank" href="Home/CompletedGrid?value=@m。电子 @"我的脚本函数调用(@item.techNo)

脚本

function call(x) 
{
    $("#techNo").val(x); 
    $("#completed").attr("href", "Home/CompletedGrid?value=" + x);
            $("#completed").attr("target", "_blank");
}