将变量连接到.NET中ASP超链接的末端
我正在尝试自定义超链接,以在每个链接的末尾附加可变程序ID,具体取决于使用哪个程序ID。
我创建了我的超链接,并添加了wikilink.navagateurl为链接,加上可变程序密码,问题仅是附加链接,而不是带有程序ID的链接。
例如,如果程序ID为5(我们的变量),并且我在单击时运行此代码,则在 https:// www.example.com/ ,不要 https://www.example.com/5 添加了带有程序ID的链接
<asp:HyperLink ID="wikiLink" runat="server" Text="Link to Wiki page" </asp:HyperLink>
protected void Page_Load(object sender, EventArgs e)
{
var ProgramID = 5;
wikiLink.NavagateUrl = "https://www.Example.com/" + ProgramID;
}
I am trying to customize my hyperlink to attach a variable Program Id at the end of each link depending on which Program Id is being used.
I Created my hyperlink and added the wikiLink.NavagateUrl to be the link plus the variable ProgrammId the issue is only the link is being attached and not the link with Program ID.
For example, if Program Id is 5(our variable) and I run this code the hyperlink when clicked goes to https://www.Example.com/ and not to https://www.Example.com/5 the link with the program id added
<asp:HyperLink ID="wikiLink" runat="server" Text="Link to Wiki page" </asp:HyperLink>
protected void Page_Load(object sender, EventArgs e)
{
var ProgramID = 5;
wikiLink.NavagateUrl = "https://www.Example.com/" + ProgramID;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您忘记使用'&gt;'关闭开放的超链接标签,并且您被拼写错误的超链接属性名称。尝试写入:
在网页和
“ .cs”文件中。
It seems you forget to close the open hyperlink tag with '>' and that you are misspelled the hyperlink property name. Try to write:
in the web page and
in the ".cs" file.