在table 里面双击一行跳转页面, 传递的参数为选中行的id ,这里我就不知道该怎么写了。
我现在用的是这种,这种不是用的双击。
我在index.cshtml 里面的
table 里面有一列是这种
  <td>
     @Html.ActionLink("详细信息", "CommodityDetails", new { CommodityID = item.CommodityID }) 
  </td>
在controller 里面我写了个方法:
//显示详细信息
        public ActionResult CommodityDetails(string CommodityID)
        {
         YmWh wh = dao.GetCommodityInfoByCommodityID(CommodityID);//查询得到选中那条数据的详细信息         return View("CommodityDetails",wh); // 返回详细页面。就是跳转到详细页面
        }
但是,我觉得现在这种感觉不好。
现在,我想 用双击的方法来写,
就不知道该怎么下手了。求高人指点。现把代码贴出,
<table id="tb1"> 
@foreach (var item in Model)
{
    <tr style=" height:25px;" id="trid">
        <td>
            @Html.DisplayFor(modelItem => item.CommodityName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CommodityNum)
        </td>
</tr>
}</table>在双击之后可以调用到如上面 controller 里面的CommodityDetails方法吗?
 如何调用。?
求破。。

解决方案 »

  1.   

    <tr style=" height:25px;" id="trid" ondblclick="location.href='/[email protected]'">
      

  2.   

    ActionLink中不是可以传递参数吗
      

  3.   


    嗯,我再请问下,
    如果我在下面加一个button 按钮,用按钮来去调用
    <table id="tb1"> 
    @foreach (var item in Model)
    {
        <tr style=" height:25px;" id="trid">
    <td style=" width:20px;">
                <input id="selCheckbox" type="checkbox" />
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CommodityName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CommodityNum)
            </td>
    </tr>
    }
    </table>
    <button id="btn_stockout" onblur="location.href='/Ym/[email protected]'"  >详细信息</button>
      

  4.   

    补充三楼:
    但选择一行,即一行前面的checkbox 勾选上,选中。然后将选中行的那个行id 拿来做为 button按钮onclick 方法的参数,这点不知道了。
     那个button 按钮又如何调用controller 里面的方法呢? 参数又是 怎么传的呢
      

  5.   

    <tr style=" height:25px;" id="trid" ondblclick="location.href='这里是controller里面方法名的路径/方法名即[email protected]'">