html - asp.net 如何使用超链接将数据从一页显示到另一页

标签 html asp.net vb.net

大家好,我在设计 Web 应用程序时,我在 addregistration 中有两个母版页 Default.aspxAddregistration.aspx 我存储了使用 SQL 数据库中的数据,我在默认页面中将数据显示为 gridview,当我单击它时,我将我的列设置为 hyperlink in grid view链接它应该转到 addregistration page 我如何用我输入的字段和文本存储数据。下面是列的 Css

最佳答案

用javascript处理。你的NavigateUrl是#,加上一个onclick事件,或者直接用一个input类型的按钮更方便

 <asp:HyperLink ID="hlink" CssClass="control" runat="server" NavigateUrl='#' onclick="gotoRegistration(<%#Bind("ReferenceNo")%>)" Text='<%#Bind("ReferenceNo")%>'></asp:HyperLink>

尝试将 ReferenceNo 传递给 JS 函数,如果 Bind 不起作用,请尝试 Eval。 和你的 JS

<script>
 function gotoRegistration(theRefNo)
{
theUrl = "~/AddRegistration.aspx?refNo="+ theRefNo
   window.location = theUrl;
}

</script>

然后您的注册页面从请求的查询中读取它

关于html - asp.net 如何使用超链接将数据从一页显示到另一页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34349711/

相关文章:

javascript - 为什么嵌入式谷歌地图会改变 Chrome 的字体渲染?

html - 是否可以在 CSS `content` 中使用(多种)字体样式?

c# - WPF文本框字符串格式忽略小数

mysql - 如何重写此 MySQL 查询以包含参数?

jquery - 自动调整大小的动态文本以填充固定大小的容器

python - 如何知道哪个表单提交到flask web服务器

jquery - 在 $.getJSON() 之外访问 json 数据

c# - 列名称无效。该名称从未在代码中实现

asp.net - AiHandleErrorAttribute 与。 Application Insights 提供的内置自动添加操作筛选器

vb.net - 为什么接口(interface)不是强类型的?