如何在字符串中显示链接 [英] How to display link in a string

查看:79
本文介绍了如何在字符串中显示链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在弹出窗口中显示一些数据我试图将网址显示为链接,但网址只是作为字符串显示



< pre lang =c#> var link = new HyperLink(){NavigateUrl = https://www.google.se,Text = https://www.google.se};

ClientScript.RegisterStartupScript( this .GetType(), 弹出 ShowPopup(' link.NavigateUrl '); true ) ;

解决方案

这里有两件事。



1)你正在创建HyperLink的对象,但不会添加到您的UI,因此该元素永远不会显示,因此如果您有自己的弹出窗口(页面),则在此处添加此元素,您需要将其显示为链接。



2)这个ShowPopup(),它是来自第三方Javascript库,如果是,则提及它并可能在该论坛中提问。



3)在旁注,你的代码不能正常工作,无论如何下面代码也行不通:(



 ClientScript.RegisterStartupScript( this  .GetType(),  Popup  ShowPopup(' + link.NavigateUrl +  '); true ) ; 





谢谢

Rushi


I am trying to display some data in a popup here i am trying to display the url as a link but the url only gets diplayed as a string

var link = new HyperLink() { NavigateUrl = "https://www.google.se", Text = "https://www.google.se" };

 ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('"link.NavigateUrl"');", true);

解决方案

There are two things here.

1) You are creating object of HyperLink but not adding to your UI, so that element is never going to be display, so if you have your own Popup Window(Page) then add this element there where you need to display it as link.

2) this ShowPopup(), is it from a 3rd party Javascript library, if yes then mentioned about it and probably ask in that forum.

3) on a side note, your code is not working, anyway below code will also not work :(

ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + link.NavigateUrl + "');", true);



Thanks
Rushi


这篇关于如何在字符串中显示链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆