[英]Pass value of <h4>tag from one aspx page to another aspx page
I am using an anchor tag in one aspx page to redirect to another aspx page.But I need to pass value of particluar h4 also from source to destination page so that I can display it on header.我在一个 aspx 页面中使用锚标记重定向到另一个 aspx 页面。但是我还需要将 particluar h4 的值也从源页面传递到目标页面,以便我可以在 header 上显示它。
first page.aspx第一页.aspx
<div class="col-lg-4 col-md-12 col-sm-12" runat="server" id="line_1">
<div class="card">
<div class="card-header position-relative">
<table style="width: 100%">
<tr>
<td style="text-align: left; width: 75%">
<h4 class="mb-0 ml-4 line_name" id="line_name_1">Place1Line</h4>
</td>
</tr>
</table>
<a href="LinePage.aspx" class="stretched-link"></a>
</div>
<div class="card-body">
</div>
</div>
</div>
<div class="col-lg-4 col-md-12 col-sm-12" runat="server" id="line_2">
<div class="card">
<div class="card-header position-relative">
<table style="width: 100%">
<tr>
<td style="text-align: left; width: 75%">
<h4 class="mb-0 ml-4 line_name" id="line_name_2">Place2Line</h4>
</td>
</tr>
</table>
<a href="LinePage.aspx" class="stretched-link"></a>
</div>
<div class="card-body">
</div>
</div>
</div>
LinePage.aspx线路页面.aspx
<div id="header1" class="float-left ml-4">
<asp:Label ID="Label2" Class="label_header" runat="server" Text=""></asp:Label>
</div>
I need h4 tag value of id line_name_1 if anchor tag of id="line_1" card is clicked.如果单击id="line_1" 卡的锚标记,我需要 id line_name_1的 h4 标记值。 similarily, h4 value of line_name_2 if anchor tag of l ine_2 card is clicked.
类似地,如果line_2 卡的锚标记被单击,则line_name_2的 h4 值。 which is to be displayed in Text="" of asp_label control.
将显示在 asp_label 控件的 Text="" 中。
You can add query strings into your anchor tags:您可以将查询字符串添加到锚标记中:
<a href="LinePage.aspx?text=TheTextToTransfer" id="line_1">YourLinkText</a>
(In the second anchor change the query.) Then access query data in your code-behind: (在第二个锚点中更改查询。)然后在您的代码隐藏中访问查询数据:
string text = Request.QueryString["text"];
And assign the value of text
as the value in your label in LinePage.aspx
.并将
text
的值指定为 LinePage.aspx 中LinePage.aspx
中的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.