将字段变量传递到aspx页面的母版页中的超链接

本文关键字:母版页 超链接 aspx 变量 字段 | 更新日期: 2023-09-27 18:13:00

我正在尝试将客户号码字段值传递给href url"http://abc.yyy/id=12& custnum = "在我的代码后面的页面,我有我的字段值

string custnum=txtcustnum.Text;

现在如何在masterpage.aspx中传递custnumhref链接

将字段变量传递到aspx页面的母版页中的超链接

在你的主页创建如下的超链接

<asp:HyperLink id="myLink" Text="Click Here" runat="server"/> 

然后在你的内容页代码后面访问这个母版页超链接并设置它的url

HyperLink hyperLinkMasterPage = this.Master.FindControl("myLink") as HyperLink;
string custnum=txtcustnum.Text;
hyperLinkMasterPage.NavigateUrl  = @"http://abc.yyy/id=12&custnum=" + custnum;