青衫唯衣 2017-04-30 09:14 采纳率: 17.4%
浏览 900

asp.net 页面跳转传值

<table class="table" id="onclik">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>姓名</th>
                                    <th>年龄</th>
                                    <th>地址</th>
                                    <th>性别</th>
                                    <th>班级</th>
                                    <th style="width: 26px"></th>
                                </tr>
                            </thead>
                            <tbody id="onclk">
                                <%

                                    System.Collections.Generic.List<ExaminationHerp.Sys_User> users = (System.Collections.Generic.List<ExaminationHerp.Sys_User>)ViewState["Users"];
                                    foreach (ExaminationHerp.Sys_User item in users)
                                    {
                                %>
                                <tr id="Message">
                                    <td><%=item.ID %></td>
                                    <td><%=item.Name %></td>
                                    <td><%=item.Age %></td>
                                    <td><%=item.Address %></td>
                                    <td><%=item.Sex==1?"男":"女" %></td>
                                    <td><%=item.ClassNa%></td>

                                    <td>
                                        <a href="#" id="onc" ><i class="icon-pencil" ></i></a>
                                        <a href="#" role="button" data-toggle="modal"><i class="icon-remove"></i></a>
                                    </td>
                                </tr>
                             <%     } %>
                            </tbody>
                        </table>

点击ID为onc的a标签跳转新的页面 并且获取跳转前页面每一个td中的文本 传入跳转后页面的每一个textbox中

  • 写回答

1条回答 默认 最新

  • Go 旅城通票 2017-04-30 12:06
    关注
     <tr id="Message">
        <td><%=item.ID %></td>
        <td><%=item.Name %></td>
        <td><%=item.Age %></td>
        <td><%=item.Address %></td>
        <td><%=item.Sex==1?"男":"女" %></td>
        <td><%=item.ClassNa%></td>
    
        <td>
            <a href="#" id="onc" onclick="setHref(this)"><i class="icon-pencil"></i></a>
            <a href="#" role="button" data-toggle="modal"><i class="icon-remove"></i></a>
        </td>
    </tr>
    <script>
        function setHref(a) {
            var tr = a.parentNode.parentNode;
            a.href = 'xxxxx.aspx'///注意修改页面名称
                + '?id=' + tr.cells[0].innerHTML + '&name=' + encodeURIComponent(tr.cells[1].innerHTML)
            + '&age=' + encodeURIComponent(tr.cells[2].innerHTML)
            + '&address=' + encodeURIComponent(tr.cells[3].innerHTML)
            + '&sex=' + encodeURIComponent(tr.cells[4].innerHTML)
            + '&classna=' + encodeURIComponent(tr.cells[5].innerHTML)
        }
    </script>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog