青衫唯衣 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 C#读写EXCEL文件,不同编译
  • ¥15 如何提取csv文件中需要的列,将其整合为一篇完整文档,并进行jieba分词(语言-python)
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置