如何在绑定数据库中的数据时提供链接 [英] How to give link in when binding data from database

查看:94
本文介绍了如何在绑定数据库中的数据时提供链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< a href =@ string.Format(%20 @ items [10])> 



以上是我的代码我正在@item [10] URL中获得价值就像www.ggg.com所以我想给出这个值的链接所以请指导我如何给予链接



我尝试了什么:



如何给出数据库值的链接

解决方案

< blockquote>由于此链接不是您自己的本地链接,因此在同一域下,您也需要使用该协议。尝试使用它,

  var  url =   http://www.ggg.com; 

< a href = @ url> Awesome Domain < span class =code-keyword>< / a >



变量的类型无关紧要 - 静态变量如var url或string [] list - 重要的是在那里加载的内容。所以,只是一个技巧,



1.对外部URL使用http协议。

2.你可以使用〜本地路径也是如此。

3.遵循URL标准,这有助于为内部文件和外部文件创建超链接;使用http,vs本地物理路径等。


<a href="@string.Format(%20@items[10])">


above is my code i am getting value in @item[10] URL Like www.ggg.com so i want to give link on this value so kindly guide me how to give link

What I have tried:

how to give link on database value

解决方案

Since this link is not your own local link, under the same domain, you would require to use the protocol with it as well. Try using this,

var url = "http://www.ggg.com";

<a href="@url">Awesome Domain</a>


The type of variable doesn't matter — static variable like var url or string[] list — what matters is what gets loaded there. So, just a tip trick,

1. Use http protocol for external URLs.
2. You can use "~" for local paths as well.
3. Follow a standard of URLs, that helps creating hyperlinks for internal files and external files; using http, vs local physical path etc.


这篇关于如何在绑定数据库中的数据时提供链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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